applet errors please help
hi guys, i hope this time my post will be visible, this is the second time when i try to post on this forum...
i have developed a piece of code and compiled with java.
i sued jdk6 as compiler and xp sp2 as os...
now, the applet loads fine and work fine all of my browsers...
the problem is with other persons which try to access my webpage, and the applet of course...
many of them say the applet won't load and display an error, ans a few reported nothing happen when they visit the page... as the applet is not there..
here is a piece of a long error list from java error console which a few users sent:
Ignored exception: java.lang.NullPointerException
java.lang.UnsupportedClassVersionError: my file : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
what is wrong with the applet? why it's working on my browsers and other don't work?
PS only 3 persons reported the applet work fine on their browser. the total users was 15.... so 12, couldn't access the applet...
thank you very much for your help!
Re: applet errors please help
Quote:
Unsupported major.minor version 51.0
What version of the compiler and JREs are involved?
For example are you using java 1.7 and your friends are using 1.6?
Re: applet errors please help
i used jdk1.6.0 as compiler and everyone else uses version 6 update 27 (build 1.6.0_27) and version 6 update 29 (build 1.6.0_29-b11)
the applet code i use to trigger the jar file is:
<applet code="myfile.class" archive="myfile.jar" width="750px" height="500px">
<param name="progressbar" value="true" />
<param name="progresscolor" value="102,102,102" />
<param name="boxmessage" value="Loading..." />
Re: applet errors please help
The error message says that a class was compiled with java 1.7 (The major version number is 50 for java 1.6)
Re: applet errors please help
it's true i had jdk1.7 installed on my computer, but i have removed all the java from my computer, and installed jdk1.6 and java standard edition 6 build 29
what should i do? how to fix this error? or how to compile with jdk1.7 and trigger the application with the correct java applet code?
Re: applet errors please help
Recompile all the code with java 1.6 should correct the problem.
Make sure there is not a java 1.7 version of javac.exe.
Open a command prompt window and enter javac -version:
Code:
Microsoft Windows XP [Version 5.1.2600]
D:\JavaDevelopment\Testing\ForumQuestions6\Testing>javac -version
javac 1.6.0_02
D:\JavaDevelopment\Testing\ForumQuestions6\Testing>
Re: applet errors please help
well, by just opening a cmd command and typing: javac -version doesn't work for me...
so i navigated to the jdk folder in program files and wne to bin then typed : javac -version
here it is:
C:\Program Files\Java\jdk1.6.0\bin>javac -version
javac 1.6.0
the jar file is super mega extra recompiled with jdk1.6.0 but the errors are there...
Re: applet errors please help
Are you absolutely sure that all the class files in the jar file were created using javac version 1.6?
The JVM is finding one that is from 1.7
Look in the jar file using a zip utility and verify that all the class files were newly created.
Could the jar file be cached for the users having the problem?
Rename the jar file and change the HTML to use the new name to see.
Re: applet errors please help
here's what i will do, i'll delete all the compiled files, except the .java file, and the recompile it and sign it, then i will try again. i really hope it related to this problem, because it's very odd... as i've said before, on some computers is working with this compiled file....
can't it be related to the applet code? the one that is in the html page? maybe it must specify the version or something?!
Re: applet errors please help
ps it's a signed jar file and i use the following commands:
javac myfile.java
jar cvf myfile.jar myfile.class
keytool -genkey -alias my_new_key -dname "cn=localhost, ou=JavaSoft, o=Sun Java, c=US"
keytool -selfcert -alias my_new_key -validity 3650
jarsigner myfile.jar my_new_key
jarsigner -verify -verbose -certs myfile.jar
is this correct?
Re: applet errors please help
Sorry, I don't have any experience with signing. I don't think that would set the major version in a class file to 51
Re: applet errors please help
ok, i compiled the new jar file, i'm testing right now, i hope will solve the problem, and will reply with a positive answer...
Re: applet errors please help
well, no luck yet... i have no idea what to do? can i use another compiler? how can i do that?
Re: applet errors please help
Have you checked if any browsers have cached an older version of the jar file?
Re: applet errors please help
all the persons who get the error and doesn't load the application has cleared the history/and files of the browser...
how about if i compile with jdk1.7? will work? i assume anyone must have the latest java?!
Re: applet errors please help
The error message says the class file is from 1.7 but the JVM is an older version.
Re: applet errors please help
so the jar file says it compiled with jdk1.7 ?
what is jvm ?
Re: applet errors please help
jar files are containers of files. They are not compiled.
class files are compiled. The compiler inserts a version number into the class files it creates
The Java Virtual Machine is created by the java program when it executes your class files.
Re: applet errors please help
how can i compile the .java file with a version of jdk6 and be sure it's used the one i want?! to be opened with any version of java1.6.* ?
if i can do this i am sure the errors will disappear ...
i had once compiled the .java file, like one week ago, and it worked fine, but i've lost the .class file and .jar file, and i was forced to recompile. since then it never worked.... basically i did not change anything in the .java file... and it was the same compiler used before jdk6
Re: applet errors please help
Verify that the javac program you are using is version 1.6.
Delete all class files.
Compile all the class files with the 1.6 javac program.
Build the jar file adding only the files you compiled with 1.6
When you are done the jar file should only contain class files from the 1.6 version compiler.
If some user's find class files from the 1.7 compier, then you need to track down where they are getting the class files from.