This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Classpath Understanding" Watch "Classpath Understanding" New topic
Author

Classpath Understanding

Nittin singla
Greenhorn

Joined: Jul 02, 2011
Posts: 24
Hi,

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.

TIA


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
Bartender

Joined: Oct 02, 2003
Posts: 11153
    
  16

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
Greenhorn

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

Joined: Oct 13, 2005
Posts: 37926
    
  22
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
 
Similar Threads
[beans.xml] cannot be opened because it does not exist
Regarding CLASSPATH
Comilation Problem
diff between path & classpath
add jar files in a directory to classpath