File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JNLP and Web Start and the fly likes Help: java.lang.ClassFormatError encountered Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JNLP and Web Start
Bookmark "Help: java.lang.ClassFormatError encountered" Watch "Help: java.lang.ClassFormatError encountered" New topic

Help: java.lang.ClassFormatError encountered

Joy Chen

Joined: Jul 03, 2002
Posts: 3
I implement one simple application and package it into a jar file, the web application server is weblogic 5.1.
In the, I add the mime type for jnlp and the Java Web Start is successfully installed on my client machine.
When I use Java Web Start to load my application, the following error happens:
java.lang.ClassFormatError: Test (Bad magic number)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(
at com.sun.jnlp.JNLPClassLoader.defineClass(Unknown Source)
at com.sun.jnlp.JNLPClassLoader.access$1(Unknown Source)
at com.sun.jnlp.JNLPClassLoader$ Source)
at Method)
at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
at com.sun.javaws.Launcher.continueLaunch(Unknown Source)
at com.sun.javaws.Launcher.handleApplicationDesc(Unknown Source)
at com.sun.javaws.Launcher.handleLaunchFile(Unknown Source)
at Source)
I don't know why, could you please give me some help?
Rob Ross

Joined: Jan 07, 2002
Posts: 2205
Please change your name to comply with the naming policy to which you agreed when you registered here..

For your publicly displayed name,
use a first name, a space, and a last name.

You can change your name here:

You can also find the naming policy here:
Thank You!

SCJP 1.4
Chantal Ackermann
Ranch Hand

Joined: Sep 28, 2000
Posts: 508
hello Joy,
this error tells you that something is wrong with your class declaration.

public class ClassFormatError
extends LinkageError
Thrown when the Java Virtual Machine attempts to read a class file and determines that the file is malformed or otherwise cannot be interpreted as a class file.

it would help if you would paste the code where you declare the class Test.
John Dale
Ranch Hand

Joined: Feb 22, 2001
Posts: 399
As I recall, class files generated by some older java compilers violate the class file format in ways that are not tolerated by some 1.3.x JVMs, resulting in this message from those 1.3.x JVMs. I'm not sure whether this is the problem affecting you.
I think I saw the problem described in the Sun 1.3 release notes.
Joy Chen

Joined: Jul 03, 2002
Posts: 3
Thank you all, I just solved this problem and here are all the actions I took.
1. Restart the computer
2. Clear the Java Web Start cache
3. Recompile the program using jdk1.3.x and archive it to jar file
Then everything is ok.
I agree. Here's the link:
subject: Help: java.lang.ClassFormatError encountered
It's not a secret anymore!