• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

javac command and -cp .

 
Cyril Bil
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys.
I have this code:



Is there a difference between :

javac my/path/to/java/Class1.java

and

javac -cp . my/path/to/java/Class1.java

Because I have the same result : compilation of the 2 classes

Thanks ;)
 
Stephan van Hulst
Bartender
Pie
Posts: 6115
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, in the first case the class path is determined by the CLASSPATH environmental variable, or if it's not set, then the current directory is used for the class path.

The second case explicitly sets the class path to the current directory, overriding the CLASSPATH variable if it is set.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic