aspose file tools*
The moose likes Beginning Java and the fly likes -classpath list Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "-classpath list" Watch "-classpath list" New topic
Author

-classpath list

V Bose
Ranch Hand

Joined: Jul 10, 2003
Posts: 113
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

Joined: Jul 08, 2003
Posts: 24184
    
  34

Separate each entry with semicolons, like this:
-classpath c:\foo;d:\bar;c:\jars\my.jar;.


[Jess in Action][AskingGoodQuestions]
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
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.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Wayne L Johnson
Ranch Hand

Joined: Sep 03, 2003
Posts: 399
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

Joined: Dec 10, 2001
Posts: 7023
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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: -classpath list