Results 1 to 9 of 9
Like Tree1Likes
  • 1 Post By DarrylBurke

Thread: Chrome/java version difficulties

  1. #1
    Daimoth's Avatar
    Daimoth is offline Member
    Join Date
    Jul 2011
    Posts
    34
    Rep Power
    0

    Default Chrome/java version difficulties

    Running a HelloWorld applet results in this when opened in Chrome:

    Java Code:
    java.lang.UnsupportedClassVersionError: HelloWorld : 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)
    	at java.security.SecureClassLoader.defineClass(Unknown Source)
    	at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    	at java.lang.ClassLoader.loadClass(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
    	at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
    	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    	at java.lang.Thread.run(Unknown Source)
    Exception: java.lang.UnsupportedClassVersionError: HelloWorld : Unsupported major.minor version 51.0
    So I found out my jdk is 1.7.x and Chrome's java is 1.6.x, so I tried compiling with -source 1.6, got this warning:
    Java Code:
    bootstrap class path not set in conjunction with source 1.6
    Running the newly compiled class, I got same error. I didn't understand the warning, so I wikipedia'd "bootstrap", which didn't help make things any more clear, to be honest. So now I come here. Anybody know what the problem is?

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    7

    Default Re: Chrome/java version difficulties

    Try setting the target version JRE (-target 1.6)

  3. #3
    Daimoth's Avatar
    Daimoth is offline Member
    Join Date
    Jul 2011
    Posts
    34
    Rep Power
    0

    Default Re: Chrome/java version difficulties

    Thanks for the reply.

    Compiler refused, stating:
    Java Code:
    target release 1.6 conflicts with  default source release 1.7

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is online now Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,193
    Rep Power
    19

    Default Re: Chrome/java version difficulties

    What's the exact compiler command you entered?

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  5. #5
    Daimoth's Avatar
    Daimoth is offline Member
    Join Date
    Jul 2011
    Posts
    34
    Rep Power
    0

    Default Re: Chrome/java version difficulties

    javac *.java -target 1.6

  6. #6
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    7

    Default Re: Chrome/java version difficulties

    Quote Originally Posted by Daimoth View Post
    javac *.java -target 1.6
    javac options should precede the compilation source files.

    javac -target 1.6 mysourcefile.java

    See the help for javac: http://docs.oracle.com/javase/7/docs...ows/javac.html (see the cross-compilation example near the bottom)
    Last edited by doWhile; 06-01-2012 at 10:39 PM.

  7. #7
    Daimoth's Avatar
    Daimoth is offline Member
    Join Date
    Jul 2011
    Posts
    34
    Rep Power
    0

    Default Re: Chrome/java version difficulties

    True, but in this case it didn't fix anything.

    I've read that a way around this is to completely uninstall 1.7 and install 1.6, instead I'm going to try installing both JDK's and put them both in path.

    On a computer with properly updated Chrome, the plugins all work, but I would like to know how to add backward compatibility to my little programs. Do you guys have any tips or resources for that?

  8. #8
    DarrylBurke's Avatar
    DarrylBurke is online now Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,193
    Rep Power
    19

    Default Re: Chrome/java version difficulties

    May be related to this bug report: Bug ID: 6856165 tests with explicit -target 1.5 fail with jdk7 since javac now defaults to 1.7

    Try
    Java Code:
    javac -source 1.6 -target 1.6 mysourcefile.java
    db
    doWhile likes this.
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  9. #9
    Daimoth's Avatar
    Daimoth is offline Member
    Join Date
    Jul 2011
    Posts
    34
    Rep Power
    0

    Default Re: Chrome/java version difficulties

    Bleh, I'm anxious to try your solution, but I don't have access to the crappy computer on which I had this problem.

Similar Threads

  1. Safari & Chrome Problem - Please Help! New to Java
    By azonicds2 in forum New To Java
    Replies: 2
    Last Post: 03-23-2012, 04:06 PM
  2. Java Applet is not working in Google Chrome
    By AsoInfo in forum Java Applets
    Replies: 2
    Last Post: 01-28-2012, 05:56 AM
  3. IE9 and Chrome
    By turboscrew in forum Suggestions & Feedback
    Replies: 2
    Last Post: 05-19-2011, 03:34 PM
  4. java -version pointing to older version
    By deepakts in forum New To Java
    Replies: 4
    Last Post: 05-06-2010, 09:59 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
  •