Results 1 to 4 of 4
- 05-20-2012, 02:46 PM #1
Member
- Join Date
- May 2012
- Posts
- 2
- Rep Power
- 0
what is the need and use of .; in classpath ?
I kept FirstProgram.java in Test folder of D drive.I set path as C:\Program Files\Java\jdk1.6.0_32\bin in environment variable.
I compiled and got FirstProgram.class in Test folder of D drive.
FirstProgram.java
public class FirstProgram{
public static void main(String args[]){
System.out.println("Welcome");
}
}
I set classpath as D:\Test;.; in environment variable.
When I run the above code by typing java FirstProgram in C drive in DOS prompt,It gave Welcome output.
I modified classpath as D:\Test; in environment variable.
I removed .; from classpath.
When I run the above code by typing java FirstProgram in C drive in DOS prompt,It gave same output.
Then,what is the need and use of adding .; in classpath ?.Last edited by kumarkumar; 05-20-2012 at 03:02 PM.
- 05-20-2012, 03:45 PM #2
Re: what is the need and use of .; in classpath ?
The dot is a way to reference the current folder.
If you don't understand my response, don't ignore it, ask a question.
- 05-20-2012, 03:56 PM #3
Member
- Join Date
- May 2012
- Posts
- 2
- Rep Power
- 0
Re: what is the need and use of .; in classpath ?
1. Does Current folder represent the directory of dos prompt from where I run java program ?.
Here I run the above code from C drive in DOS prompt.So here does Current folder (.) represent C directory?.
2. Even after I removed .; from classpath environment variable,code runs perfectly.so what is the need to keep .; in classpath ?.Last edited by kumarkumar; 05-20-2012 at 03:59 PM.
- 05-20-2012, 04:01 PM #4
Re: what is the need and use of .; in classpath ?
The current directory is the default.
java Classname
The above works IF the environment variable is NOT set or if it includes the dot.
The above won't work if Classname is in the current directory and the current directory is not on the classpath.If you don't understand my response, don't ignore it, ask a question.
Similar Threads
-
ClassPath
By homka in forum New To JavaReplies: 0Last Post: 10-05-2011, 01:18 PM -
what is runtime classpath and what is designtime classpath?
By LongTTH in forum New To JavaReplies: 1Last Post: 05-03-2011, 02:28 AM -
DTD on a classpath
By frenk_castle in forum XMLReplies: 0Last Post: 03-29-2011, 07:26 PM -
Classpath
By Parneel in forum Enterprise JavaBeans (EJB)Replies: 4Last Post: 04-01-2009, 12:22 PM -
j3d classpath
By sales1 in forum New To JavaReplies: 3Last Post: 12-23-2008, 01:51 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks