Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

-classpath list

 
V Bose
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you specify a list of classpath(s) when invoking the command line javac compiler, with a -classpath switch, in a Windows environment ?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Separate each entry with semicolons, like this:
-classpath c:\foo;d:\bar;c:\jars\my.jar;.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For any Linux-using Java greenhorn lurkers out there, note that different locations in the classpath setting are separated with a colon - not with a semicolon as is used on Windows.
 
Wayne L Johnson
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java is pretty agnostic when it comes to path separators, so you can use either type of slash when specifying a path. Thus you could use:
-classpath c:/foo;d:/bar;c:/jars/my.jar;.
on Windows and it would work just as well. When using file paths in Java, I find it easier to use:
String props = "C:/MyApp/resources/main.properties";
than
String props = "C:\\MyApp\\resources\\main.properties";
As I switch between UNIX and Windows, I'm always using the same path separator which keeps things consistent.
[ September 11, 2003: Message edited by: Wayne L Johnson ]
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your post isn't perfectly clear to me.
I'm not a Linux user, I just pretend to give CLASSPATH advice at times.
Someone once told me that the CLASSPATH locations on Linux had to be separated with colons. Is this not the case and we can just use semicolons as with Windows?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic