Results 1 to 3 of 3
  1. #1
    bytescode is offline Member
    Join Date
    Jan 2011
    Posts
    8
    Rep Power
    0

    Default Java Applet Error at Eclipse on Linux Ubuntu

    Hi all,

    I'm a newbie at Java. I'm try to learn about applet java using Eclipse (version 3.2.2) using java-1.5.0-gcj-4.3-1.5.0.0 at Linux Ubuntu 9.04

    My script like this :
    /*
    Mencoba membuat applet di Eclipse linux Ubuntu
    pada browser Mozilla Firefox
    */

    import java.applet.*;
    import java.awt.*;

    public class TesBrowser extends Applet {
    public void gambar (Graphics g) {
    Font font = new Font ("Courier", Font.BOLD, 20);
    g.setFont(font);
    g.drawString("Gue lagi belajar Java Applet di Eclipse Ubuntu", 20, 30);
    }

    }


    And my HTML script like this :
    <html>
    <body>
    <APPLET code="TesBrowser" width="400" height="100">
    </APPLET>
    </body>
    </html>


    Both of them (java and HTML script) saved at same directory.

    It can't be run well and show error message like this :
    Exception in thread "main" java.lang.NoClassDefFoundError: sun.applet.AppletViewer
    at gnu.java.lang.MainThread.run(libgcj.so.90)
    Caused by: java.lang.ClassNotFoundException: sun.applet.AppletViewer not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:/home/bytescode/Desktop/Materi Kuliah S2 Informatika ITB Teknologi Informasi/pemrograman dan aplikasi internet web/kuliah_web_programming/koding/BrowserApplet/], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
    at java.net.URLClassLoader.findClass(libgcj.so.90)
    at gnu.gcj.runtime.SystemClassLoader.findClass(libgcj .so.90)
    at java.lang.ClassLoader.loadClass(libgcj.so.90)
    at java.lang.ClassLoader.loadClass(libgcj.so.90)
    at gnu.java.lang.MainThread.run(libgcj.so.90)


    Help me, what's wrong with my script and or my java or eclipse?

    Thanks for your help.

  2. #2
    j2me64's Avatar
    j2me64 is offline Senior Member
    Join Date
    Sep 2009
    Location
    Zurich, Switzerland
    Posts
    962
    Rep Power
    5

    Default

    you can copy this code in your file TesBrowser.java

    Java Code:
    import java.applet.*;
    import java.awt.*;
    
    public class TesBrowser extends Applet {
    	
    	public void paint(Graphics g) {
    		Font font = new Font ("Courier", Font.BOLD, 20);
    		g.setFont(font);
    		g.drawString("Gue lagi belajar Java Applet di Eclipse Ubuntu", 20, 30);
    	}
    }

    save it in, right-click the java-file and then Run As -> Java Applet. when all is ok, integrate it in your html-file.

  3. #3
    bytescode is offline Member
    Join Date
    Jan 2011
    Posts
    8
    Rep Power
    0

Similar Threads

  1. Replies: 0
    Last Post: 01-03-2011, 03:24 PM
  2. Replies: 5
    Last Post: 07-07-2010, 12:50 PM
  3. starting java programming on ubuntu linux
    By hmjsaumya in forum New To Java
    Replies: 1
    Last Post: 01-23-2010, 06:28 AM
  4. Replies: 3
    Last Post: 08-25-2009, 04:01 PM
  5. Eclipse in Ubuntu
    By DavidG24 in forum Eclipse
    Replies: 2
    Last Post: 04-18-2009, 03:10 PM

Posting Permissions

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