?
Solved

What does this mean and how can i fix it.     java.lang.ClassFormatError Bad magic Number

Posted on 2003-03-13
18
Medium Priority
?
219 Views
Last Modified: 2013-11-18
I'm trying to upload an applet to my page and I keep getting this error.
Could anyone please help me with this?
Thanks for your time
0
Comment
Question by:johnome
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
  • 3
  • +3
18 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 8128430
 It means that your class file is probably corrupted. Can you recompile your applet and try again?
0
 
LVL 35

Expert Comment

by:girionis
ID: 8128456
 It coudl also mean that if you FTPed/dowanloadd the appelt from somewhere you got it in ASCII mode and not in binary mode.
0
 

Author Comment

by:johnome
ID: 8128458
I've done that a few times so far. Does it have something to do with being in ascii or binary.?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:johnome
ID: 8128475
how would i convert it to binary ?

0
 

Author Comment

by:johnome
ID: 8128484
how would i convert it to binary ?

0
 

Author Comment

by:johnome
ID: 8128488
how would i convert it to binary ?

0
 
LVL 35

Expert Comment

by:TimYates
ID: 8128548
when you ftp, type "bin" before you send the applet
0
 
LVL 9

Expert Comment

by:Venci75
ID: 8128553
what java plug-in do you use?
did you compile your classes with the same java version?
0
 

Author Comment

by:johnome
ID: 8128622
i use plugin 1.3 and i wrote the applet using jdk1.4.
0
 
LVL 9

Expert Comment

by:Venci75
ID: 8128655
try to recompile your calsses using jdk 1.3
0
 
LVL 9

Assisted Solution

by:yongsing
yongsing earned 100 total points
ID: 8128669
You must have gotten the exception on Netscape. I had this experience previously. The reason was that I compiled the applet on JDK 1.4, and tried to run it on Netscape, which has a VM of 1.1.

Sun introduced new language features in 1.4 and doesn't want older VMs to even try running those new classes. Each class file contains a "language version number" in its header. So the 1.4 class file would have an unmatched number. What you can do is to compile using the -target tag:

javac -target 1.3 YourApplet.java

The other solution is simply install the 1.4 plug-in.
0
 
LVL 35

Accepted Solution

by:
girionis earned 100 total points
ID: 8128696
 It's always advisable to use the same JDK and JRE to compile and run the classes.
0
 
LVL 9

Expert Comment

by:yongsing
ID: 8128765
If you applet only uses 1.1 features, you should compile with -target 1.1. It will work on both Netscape and Internet Explorer, with or without plug-ins.
0
 
LVL 35

Expert Comment

by:girionis
ID: 8128806
 It depends... If it's a JApplet it's not going to run without the plugin.
0
 

Expert Comment

by:CleanupPing
ID: 9058712
johnome:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 9

Expert Comment

by:yongsing
ID: 9069321
I should get the points. Anyone disagree?
0
 
LVL 35

Expert Comment

by:girionis
ID: 9762665
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Split points between girionis and yongsing

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

girionis
EE Cleanup Volunteer
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues undeā€¦
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This video teaches viewers about errors in exception handling.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question