Symbian
Symbian OS Library

FAQ-0264 What are the default class paths?

[Index][spacer] [Previous] [Next]



 

Classification: Java Category: Deployment
Created: 08/06/99 Modified: 12/02/2001
Number: FAQ-0264
Platform: ER5

Question:
I put my jar file in a directory on the classpath but the VM says "class not found" although I know the class is in the jar file. What is going on?

Answer:
The first important thing is to establish what exactly is being run because the default classpath will be different depending on which VM is being used.
The default classpath for the emulators shipped with the EPOC SDK for Java is as follows

.;/classes;?:/ext/*;?:/lib/classes.zip

However the default classpath for the ARM version shipping with the MX5 is

.;?:/System/Java/classes;?:/System/Java/ext/*;?:/System/Java/lib/classes.zip

Note that the documentation with the EPOC SDK for Java actually says this, although it makes no reference to the MX5 as such.

The other thing to be aware of is that using -classpath on the command line will over-ride the default classpath, that is, if -classpath is used then it must explicitly include every directory and jar file containing classes needed by the application. To avoid this happening -cp should be used instead. This will remove "." (the current directory) from the default class path and prepend the argument to -cp to it instead.