Symbian
Symbian OS Library

FAQ-0914 My PersonalJava application always fails to run exiting with 'Exception in thread "main" java.lang.NoClassDefFoundError'. Why is this?

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



0
 

Classification: Java Category: Emulator
Created: 08/05/2003 Modified: 03/11/2004
Number: FAQ-0914
Platform: Symbian OS v7.0

Question:
I'm trying to launch my PersonalJava application from the command line using the UIQ Emulator. It always fails to run, exiting with Exception in thread "main" java.lang.NoClassDefFoundError.

I have checked the classpath and know it is correct.


Answer:
The normal cause of this exception is an incorrectly set classpath to your compiled classes. However it can also manifest itself if you are using the JDK 1.4.x (J2SE 1.4.x) to compile your Java source.

    Symbian's PersonalJava runtime environment expects classes compiled into the JDK 1.1 class file format. By default JDKs 1.2.x and 1.3.x compilers produced class files in the JDK 1.1 class file format. However with the arrival of the JDK 1.4.x the default class file format produced by javac compiler is now the 1.2 format. Hence when compiling sources with the JDK1.4.x or later you must explicitly request the 1.1 class file format using the javac -target 1.1 option.