Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: java.lang.NoClassDefFoundError Help

  1. #1
    Junior Member
    Join Date
    Jul 2012
    Posts
    2
    My Mood
    Fine
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default java.lang.NoClassDefFoundError Help

    Hello Everyone !
    I want to run a java program on a server...
    if i create a HelloWorld.java
    it is comipled and run without problems
    javac HelloWorld.java
    java HelloWorld
    But if i want ro run my programm that has 2 classes and a jar file (created in Eclipse from a dosen of packages)
    the compilation doesn't throw anything but when i try to run it its throwing java.lang.NoClassDefFoundError
    the way i compile and run is as follows:
    javac  -classpath ffann.jar  *.java
    java    -classpath ffann.jar  MyClass

    Any Help is appreciated...!!!

  2. #2
    Member
    Join Date
    Jul 2012
    Posts
    119
    Thanks
    0
    Thanked 19 Times in 19 Posts

    Default Re: java.lang.NoClassDefFoundError Help

    you "shorten" the way too fast....
    1) javac *.class
    2) jar cvfe myjar.jar myEntry *.class
    3) java -jar myjar.ja

  3. #3
    Member
    Join Date
    Jul 2012
    Posts
    119
    Thanks
    0
    Thanked 19 Times in 19 Posts

    Default Re: java.lang.NoClassDefFoundError Help

    ..sorry for the missing r in 3) due to my keyboard-troubles. The r always needs a hefty press
    3) java -jar myjar.jar

  4. #4
    Junior Member
    Join Date
    Jul 2012
    Posts
    2
    My Mood
    Fine
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: java.lang.NoClassDefFoundError Help

    Thank you!
    I will try it tonight and post the results....
    However, i thought that javac creates the classes..
    at the begining I have 2 java files(one of them has the main function) and one jar file (as external library)
    so, first of all i have to compile the source code from File1.java File2.java with ffann.jar library

Similar Threads

  1. java.lang.NoClassDefFoundError help?
    By softballfrk13608 in forum Threads
    Replies: 2
    Last Post: March 6th, 2012, 02:22 PM
  2. java.lang.NoClassDefFoundError incompatible with
    By mackogacko in forum What's Wrong With My Code?
    Replies: 9
    Last Post: November 30th, 2011, 05:29 AM
  3. Java.lang.NoClassDefFoundError
    By mikedflip2006 in forum Exceptions
    Replies: 0
    Last Post: November 21st, 2011, 10:29 PM
  4. java.lang.NoClassDefFoundError
    By nrao in forum What's Wrong With My Code?
    Replies: 1
    Last Post: January 27th, 2011, 07:18 AM
  5. java.lang.NoClassDefFoundError
    By anonymous001 in forum What's Wrong With My Code?
    Replies: 8
    Last Post: January 26th, 2011, 03:41 PM

Tags for this Thread