FAQ

Java

JSP

Servlet


Advertisement



How to specify multiple class search directories in the '-classpath' option of javac?

In developing a Java application, your class search path will contain numerous directories and JAR archives. The -classpath option to javac and java allows multiple entries to be specified. Enter the class path, using the appropriate separator character (colon for UNIX platforms, semicolon for Windows):

On UNIX, we would do this:

javac -classpath dir1:dir2:dir3 ...

whereas on Windows we have:

javac -classpath dir1;dir2;dir3 ...

The reason for the difference is that Windows uses the colon (:) character as part of a filename, so it can't be used as a filename separator. Naturally the directory separator character is different as well: forward slash (/) for UNIX and backslash (\) for Windows.

 


Printer-friendly version Printer-friendly version | Send this 
article to a friend Mail this to a friend

Previous Next vertical dots separating previous/next from contents/index/pdf Contents

  |   |