aspose file tools*
The moose likes Beginning Java and the fly likes Use of Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Use of "." in classpath" Watch "Use of "." in classpath" New topic
Author

Use of "." in classpath

Donald R. Cossitt
buckaroo
Ranch Hand

Joined: Jan 31, 2003
Posts: 401
I saw this in a search result.
This leaves me with a question: if "." is in classpath, does this mean that whatever folder I have stored the *.java file is where the *.class will be compiled too?
Additionally, is there a way to get a windows system to compile *.class files to whatever folder you are currently working in automatically? Having to adjust environment variables continuosly is a pain in the - well you know.
Maybe I am missing something... :roll:
TIA


doco
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9043
    
  10
This leaves me with a question: if "." is in classpath, does this mean that whatever folder I have stored the *.java file is where the *.class will be compiled too?
Additionally, is there a way to get a windows system to compile *.class files to whatever folder you are currently working in automatically? Having to adjust environment variables continuosly is a pain in the - well you know.


1) classpath has absolutely nothing to do with compilation. It has to do with runtime. The dot means that whichever folder you are in is automatically included in your (runtime) classpath.

2) You can use the javac flag '-d' with a dot. For example
javac -d . YourClass.java


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Donald R. Cossitt
buckaroo
Ranch Hand

Joined: Jan 31, 2003
Posts: 401

[ April 14, 2004: Message edited by: Donald R. Cossitt ]
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
1) classpath has absolutely nothing to do with compilation. It has to do with runtime. The dot means that whichever folder you are in is automatically included in your (runtime) classpath.
The CLASSPATH absolutely gets involved with compilation. Its value is used by the compiler to locate class dependencies needed during compilation.
The CLASSPATH has nothing to do with the placement of compiled classes. By default, they're placed in the same directory where the source file is located. As mentioned, you can change this placement location by using the -d switch when compiling.
[ April 14, 2004: Message edited by: Dirk Schreckmann ]

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Use of "." in classpath
 
Similar Threads
How to set up jdk environment variables in Window 2000
problem finding resouircebundle?
problem in running t he program
SOURCEPATH
loading images from an specific directory