Results 1 to 3 of 3
  1. #1
    DaveAp7 is offline Member
    Join Date
    Feb 2012
    Posts
    5
    Rep Power
    0

    Angry Making an Applet in Mac Lion.

    Hi there! This is my first question, and the reason I made an account really, so don't laugh. I've been stuck on this problem the past three days and I haven't made any real progress with it. All that I am trying to do is make an applet where I can see a red box, that's it. Here's my code for my Java and HTML files.

    JAVA
    import javax.swing.JApplet;
    import java.awt.*;

    public class Fish extends JApplet
    {
    public void paint(Graphics g)
    {
    g.setColor( Color.red );
    g.drawRect( 0,0,500,500 );
    }
    }

    HTML
    <html>
    <head>
    <title>
    k1
    </title>
    </head>
    <body>
    <applet code = "Fish.class" width=500 height=500>
    </applet>
    </body>
    </html>

    I compiled my Fish.java using the terminal line javac -classpath . Fish.java and both files (actually, all three after I compiled) are on my desktop. However, when I double click k1.html, on any browser, I get an error. I even ran the terminal code /Applications/Utilities/Java\ Preferences.app/Contents/MacOS/Java\ Preferences to make sure my Java was on for my browsers and it was. Can I get some help?!

    Thanks! :)

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

    Default Re: Making an Applet in Mac Lion.

    I get an error.
    What error? Post it in its entirety

  3. #3
    DaveAp7 is offline Member
    Join Date
    Feb 2012
    Posts
    5
    Rep Power
    0

    Default Re: Making an Applet in Mac Lion.

    Quote Originally Posted by doWhile View Post
    What error? Post it in its entirety
    load: class Fish.class not found.
    java.lang.ClassNotFoundException: Fish.class
    at sun.plugin2.applet.Applet2ClassLoader.findClass(Ap plet2ClassLoader.java:252)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(P lugin2ClassLoader.java:249)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Pl ugin2ClassLoader.java:179)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Pl ugin2ClassLoader.java:160)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 47)
    at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Plu gin2ClassLoader.java:690)
    at sun.plugin2.applet.Plugin2Manager.createApplet(Plu gin2Manager.java:3045)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionR unnable.run(Plugin2Manager.java:1497)
    at java.lang.Thread.run(Thread.java:680)
    Exception: java.lang.ClassNotFoundException: Fish.class

    Desktop:
    Making an Applet in Mac Lion.-screen-shot-2012-01-31-8.04.04-pm.png

    Code:
    Making an Applet in Mac Lion.-screen-shot-2012-01-31-8.07.01-pm.png

    However, k1.html and Fish.class are both on my desktop! I'm sorry for being unclear before, can you give me ny advice? I've been trying to solve this for a while.

Similar Threads

  1. Java issue on Mac Lion
    By vrobic in forum New To Java
    Replies: 1
    Last Post: 11-07-2011, 03:25 PM
  2. Need help making an applet that displays a pie chart.
    By jeskoston in forum New To Java
    Replies: 5
    Last Post: 05-14-2011, 01:33 AM
  3. Applet making cookies
    By mneskovic in forum New To Java
    Replies: 18
    Last Post: 08-31-2010, 05:32 AM
  4. Making a program out of a Java Applet
    By Bomber_Will in forum Java Applets
    Replies: 1
    Last Post: 07-16-2009, 03:54 AM
  5. Making an Applet use a MySQL Database
    By Bomber_Will in forum Java Applets
    Replies: 5
    Last Post: 11-30-2008, 05:28 PM

Tags for this Thread

Posting Permissions

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