Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: My first java applet

  1. #1
    Junior Member
    Join Date
    Apr 2012
    Thanked 0 Times in 0 Posts

    Default My first java applet

    Hi everyone, I know my code works when I run it in eclipse but it does not load in my browser. I have tried my best to find similar posts but none of the solutions helped me fix my problem.

    I have Java Plug-in 1.6.0_31 for my Chrome / Firefox browser

    I may have messed up the path trying to debug this problem.... but my current path is this:
    C:\WINDOWS\system32;C:\Program Files\Java\jdk1.7.0_03\bin

    I have jdk1.7.0_03, jdk1.7.0, and jdk1.6.0_31 installed, I have different ones because I tried to debug the problem myself...

    In my Eclipse compiler I have tried editing the options: Window->Preferences->Java->Compiler and I have tried to compile my code as 1.7, 1.6.. etc. At the same time I would change the selected JRE used again trying to debug this problem... Window->Preferences->Java->Installed JREs.

    this is my current Java code, I have tried other code samples as well, but this should work just as well...

    import javax.swing.JApplet;
    import java.awt.*;
    public class Test extends JApplet {
        public void paint(Graphics gfx) {
        	gfx.drawString("HELLO THERE", 100, 100);

    Here's my HTML code, I've tried changing it several times also as other sources I have looked up suggested. But here is the simplest one:

    <applet code="Test" width=1000 height=550>

    The error I recieve when trying to load my applet in a browser is this:

    basic: Added progress listener: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@125e2eb
    basic: error: Test : Unsupported major.minor version 51.0.
    java.lang.UnsupportedClassVersionError: Test : 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: Test : Unsupported major.minor version 51.0

    I've tried to debug this myself and have failed.... I tried looking up the error and from what I read, I thought maybe it was because I was trying to use 1.y java to read 1.x compiled code.

    If anyone can help me with this problem I would greatly appreciate it and if more information is needed I'll gladly give it.

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Eastern Florida
    Thanked 2,465 Times in 2,416 Posts

    Default Re: My first java applet

    Unsupported major.minor version 51.0.
    You get that error message when you compile with 1.7 and execute with 1.6
    Try to use the save version of the java program as the javac program.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Apr 2012
    Thanked 0 Times in 0 Posts

    Default Re: My first java applet

    I got one of my old computers from the garage and set everything up on it and I was able to get the applet working. I think this is a better option than debugging the issue with my laptop. Thanks for the reply Norm.

Similar Threads

  1. Java Applet Coding Help?
    By Drag01 in forum Java Applets
    Replies: 1
    Last Post: April 26th, 2012, 07:03 AM
  2. Java Applet
    By Ludicrous in forum Java Applets
    Replies: 7
    Last Post: March 31st, 2012, 02:40 PM
  3. Java Applet and MySQL
    By Terillius in forum JDBC & Databases
    Replies: 4
    Last Post: August 21st, 2010, 10:05 PM
  4. Need help with java applet game.
    By vlan in forum What's Wrong With My Code?
    Replies: 0
    Last Post: April 10th, 2010, 04:18 AM
  5. Help with 1st Java applet game!
    By Sneak in forum Java Applets
    Replies: 0
    Last Post: November 28th, 2009, 11:20 AM