facebook

Java Maven Project – Run As Java Application

  1. MyEclipse IDE
  2.  > 
  3. Maven for MyEclipse (Maven4MyEclipse)
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #292214 Reply

    tames
    Member

    This is probably due to my ignorance, but since I started using the Java Maven Project I cannot run classes by doing a right click on the source code and choosing Run As–>Java Application.

    I get a
    java.lang.NoClassDefFoundError: org/promedica/nr/icsutil/TestProdServerConn

    The TestProdServerConn is the class I am trying to run. I can get it to run from a command line. The build path is a very long path that ends in …/target/classes/. The class file is there in org/promedica/nr/icsutil/TestProdServerConn.

    I have tried going through this in Run Configurations by choosing the main class with the search button. The search does find the class, but I still cannot run it.

    If I build classes in a regular Java Project, using …/bin/ directory structure, I have no problems running my classes with Eclipse. What am I missing?

    #292370 Reply

    tames
    Member

    Figured this out myself after a lot of digging.

    In case anyone else is as ignorant as me:

    Create a run configuration for the class.
    Go to the classpath tab
    Click Advanced
    Select Add Folders (default), click OK
    Navigate to the …./target/classes folder of your project and hit OK.

    This will put a folder entry under “User Entries”. Your class should now run with this run configuration.

    –Tim

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Java Maven Project – Run As Java Application

You must be logged in to post in the forum log in