Page 1 of 3 123 LastLast
Results 1 to 20 of 55
  1. #1
    newbie_jar is offline Member
    Join Date
    Nov 2011
    Posts
    30
    Rep Power
    0

    Angry 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!

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,900
    Rep Power
    25

    Default Re: applet errors please help

    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?

  3. #3
    newbie_jar is offline Member
    Join Date
    Nov 2011
    Posts
    30
    Rep Power
    0

    Default 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..." />

  4. #4
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,900
    Rep Power
    25

    Default 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)

  5. #5
    newbie_jar is offline Member
    Join Date
    Nov 2011
    Posts
    30
    Rep Power
    0

    Default 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?

  6. #6
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,900
    Rep Power
    25

    Default 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:
    Java 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>

  7. #7
    newbie_jar is offline Member
    Join Date
    Nov 2011
    Posts
    30
    Rep Power
    0

    Default 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...

  8. #8
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,900
    Rep Power
    25

    Default 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.

  9. #9
    newbie_jar is offline Member
    Join Date
    Nov 2011
    Posts
    30
    Rep Power
    0

    Default 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?!

  10. #10
    newbie_jar is offline Member
    Join Date
    Nov 2011
    Posts
    30
    Rep Power
    0

    Default 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?

  11. #11
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,900
    Rep Power
    25

    Default 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

  12. #12
    newbie_jar is offline Member
    Join Date
    Nov 2011
    Posts
    30
    Rep Power
    0

    Default 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...

  13. #13
    newbie_jar is offline Member
    Join Date
    Nov 2011
    Posts
    30
    Rep Power
    0

    Default 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?

  14. #14
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,900
    Rep Power
    25

    Default Re: applet errors please help

    Have you checked if any browsers have cached an older version of the jar file?

  15. #15
    newbie_jar is offline Member
    Join Date
    Nov 2011
    Posts
    30
    Rep Power
    0

    Default 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?!

  16. #16
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,900
    Rep Power
    25

    Default Re: applet errors please help

    The error message says the class file is from 1.7 but the JVM is an older version.

  17. #17
    newbie_jar is offline Member
    Join Date
    Nov 2011
    Posts
    30
    Rep Power
    0

    Default Re: applet errors please help

    so the jar file says it compiled with jdk1.7 ?
    what is jvm ?

  18. #18
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,900
    Rep Power
    25

    Default 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.

  19. #19
    newbie_jar is offline Member
    Join Date
    Nov 2011
    Posts
    30
    Rep Power
    0

    Default 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

  20. #20
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,900
    Rep Power
    25

    Default 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.

Page 1 of 3 123 LastLast

Similar Threads

  1. applet loading errors strange?!
    By newbie_jar in forum Java Applets
    Replies: 1
    Last Post: 11-08-2011, 06:35 PM
  2. Replies: 4
    Last Post: 01-04-2011, 01:36 AM
  3. I need help fixing my Java applet, I keep getting errors.....
    By danielmessick in forum Advanced Java
    Replies: 3
    Last Post: 03-08-2010, 06:48 AM
  4. Replies: 10
    Last Post: 10-11-2009, 08:07 PM
  5. errors for a java applet
    By darren345 in forum Java Applets
    Replies: 3
    Last Post: 04-24-2009, 11:41 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •