Vaadin don't see classes from other Java project

Hi,

I am new in Vaadin. My problem is that my Vaadin project don’t see my classes from other project in Java. I added them by
Right click the project → Properties → Java Build Path → Projects tab
.

I have there for example class Person. If in my Vaadin project I write something like this (in file MyVaadinExampleUI):

@Override
protected void init(final VaadinRequest request) {
    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    setContent(layout);

    Button button = new Button("Start Computing");
    button.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            [b]

Person p = new Person();
[/b]
p.setName(“Jacob”);
layout.addComponent(new Label(p.getName()));
}
});

Unfortunately, it isn’t working, because I am getting:
java.lang.NoClassDefFoundError: PersonModel/Person

I am really confused, because any other Java project see my Person class and is working fine.

Do you have any idea how can I solve my problem? I will really grateful for any help. Thanks in advance!

Hi!

  • I assume you are working with eclipse
  • Adding an other project to the build path satifies only the compiler!
  • java.lang.NoClassDefFoundError: PersonModel/Person seems to be a runtime message from the server
  • If you are working with Tomcat you must add the the other project to
    Properties->Deployment Assembly
  • If you are working with the build in J2EE preview server (jetty) you must add manually the other project to the class path of this server
    Run->Run Configuration->J2EE Preview->J2EE Preview at localhost-Tab Classpath