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 3 of 3

Thread: Strange launch problem using command prompt

  1. #1
    Member
    Join Date
    Jun 2010
    Posts
    48
    Thanks
    12
    Thanked 2 Times in 2 Posts

    Default Strange launch problem using command prompt

    I just moved to windows and have a strange problem when trying to run the application. Everytime I run a package, instead of simply writing "java Package.ClassFile" I have to write "java -classpath . Package.ClassFile". Otherwise I get NoClassDefFoundError. Why is it so? I set PATH to the bin folder in my java jdk. Also set JAVA_HOME to the jdk folder as well. JRE_HOME as well to the folder where it is located.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,166
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Strange launch problem using command prompt

    I'm not sure. Long time since I set up my environment.
    Is the system's classpath environment variable set? Does it have a . in it?

  3. The Following User Says Thank You to Norm For This Useful Post:

    Asido (September 15th, 2010)

  4. #3
    Member
    Join Date
    Jun 2010
    Posts
    48
    Thanks
    12
    Thanked 2 Times in 2 Posts

    Default Re: Strange launch problem using command prompt

    Oh, now I get it. I had set the CLASSPATH to servlet-api.jar. After deleting this variable everything is alright.

Similar Threads

  1. [SOLVED] can't run javac directly from command prompt
    By epezhman in forum Java IDEs
    Replies: 7
    Last Post: January 12th, 2011, 07:38 PM
  2. A problem with command line compilation
    By goodguy in forum Java Theory & Questions
    Replies: 4
    Last Post: August 2nd, 2010, 10:58 AM
  3. Strange problem with drawing string
    By Asido in forum What's Wrong With My Code?
    Replies: 4
    Last Post: July 26th, 2010, 03:38 PM
  4. Unable to launch app of java application
    By sharmaneelam in forum What's Wrong With My Code?
    Replies: 1
    Last Post: May 19th, 2010, 08:42 AM
  5. Strange Compiling Error
    By crism85 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: October 13th, 2009, 12:59 AM