• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem in Eclipse 3.4 running Java program

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a project that is enabled for Maven2 and Spring in Eclipse 3.4.

Running mvn clean package works correctly.

I have a MainApp class that works fine when I right click and Run Java Application.

What started to happen is ... I add another simple class in the same package and tried to run it. Now I get ...

java.lang.NoClassDefFoundError: com/bankofamerica/mst/sdg/integration/dmtidb/service/NewClass
Exception in thread "main"

I slimmed it down to just this:
package com.bankofamerica.mst.sdg.integration.dmtidb.service;

public class NewClass {
public static void main(String[] args) {
System.out.println("Hello!");
}
}

I looked at the Run Configuration and it looks similiar to the MainApp(which has no problem running and still runs).

I am beating my head wondering what is happening?

Why could MainApp work and NewClass does not?

When I look under the folders, the NewClass.class exists. The build path must be correct b/c MainApp works.

Any setting to check?



 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Intrigued, I tried this, and it worked for me. I created a new Maven-based project, created two classes with printlns in main(), and they both ran without issue by right-clicking on the class and selecting Run As > Java Application. There must be something else going on, or different about your project that you did not mention.
 
I think he's gonna try to grab my monkey. Do we have a monkey outfit for this tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic