• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Use of "." in classpath

 
buckaroo
Posts: 401
Postgres Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Donald R. Cossitt
buckaroo
Posts: 401
Postgres Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

[ April 14, 2004: Message edited by: Donald R. Cossitt ]
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic