jQuery in Action, 3rd edition
The moose likes Beginning Java and the fly likes Classpath Understanding Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Classpath Understanding" Watch "Classpath Understanding" New topic

Classpath Understanding

Nittin singla

Joined: Jul 02, 2011
Posts: 24

I want to know the meaning of :. in classpath. Also i want to know, what to i need to set my classpath if i want to get the class files generated in the same folder where java files are present.


Rameshwar Soni
Ranch Hand

Joined: Feb 03, 2011
Posts: 247
According to me CLASSPATH is nothing but telling java where it should find the class file which you have created after successful compilation of java source file.
Now to set the CLASSPATH all that you have to write on the command prompt is set CLASSPATH=path of the folder where your class file is located.
Example... Suppose i save all my .java(dot java i.e. java source file) and .class(dot class file) in My_Java folder which is present in C drive i.e. C:\My_Java.
. So i would write this on command prompt set CLASSPATH=c:\My_Java;.
Now the one which was done above was temporary i.e. once you close your command prompt you would have to set the CLASSPATH again. SO the permanent solution is
Right click on My Computer>Properties>Advanced tab>Environment variable> and set your CLASSPATH in system variables.
. I hope you are using Windows OS
fred rosenberger
lowercase baba

Joined: Oct 02, 2003
Posts: 11955

the dot means "the current directory" - basically, the directory you are in when you type "java classname"

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Nittin singla

Joined: Jul 02, 2011
Posts: 24
Thanks for the replies.Yes i got it..
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46375
Beware of classpaths; you can do lots more harm than good with them. Especially: avoid setting a system classpath if at all possible.
I agree. Here's the link: http://aspose.com/file-tools
subject: Classpath Understanding
It's not a secret anymore!