Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
    Bookmark Topic Watch Topic
  • New Topic

Need to Set Classpath

 
Lavesh saxena
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Report post to moderator
Can anybody please tell me how to set Classpath. where do we need to set this path...

As i am getting error during execute the program. there is no error in compilation...

"Exception in thread "main" java.lang.Noclassdeffounderror"

 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
Here is a good place to start.
 
Lavesh saxena
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Report post to moderator
Actually i didn't get this point...

As i have made one program & save in my path "D:\Java_Programs\"....

After that i compiled my program as below.

C:\ javac D:\Java_Programs\Example.java

after that there was no error then execute my program

C:\ java D:\Java_Programs\Example

so i got errors. its mention below

"Exception in thread "main" java.lang.Noclassdeffounderror".

Can you please help to rectify above error.

 
James Tharakan
Ranch Hand
Posts: 580
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Report post to moderator
If you have set the CLASSPATH to \Java_Programs\
then the below will work
C:\ java Example


or try this..
C:\ java -cp D:\java_programs Example
 
Preet Prasannan.
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Report post to moderator
I guess the best way would be .
Go the command prompt
C:\ set classpath=<path of lib folder in your jdk ex. C:\Proram FIles\j2sdk 1.4.2\lib>;.;
The ;.; makes sure your this apth gets concanated to your existing class path.
ALso set the path in the same way but make it to pint to bin folder of jdk.
Hope it helps :-)
 
Campbell Ritchie
Sheriff
Pie
Posts: 48952
60
  • Mark post as helpful
  • send pies
  • Report post to moderator
Closing thread as duplicate.
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic