LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-28-2004, 04:36 PM   #1
nro
Member
 
Registered: Oct 2003
Distribution: Mandrake 9
Posts: 46

Rep: Reputation: 15
Java applet error: "Applet Failed"


First, here is my code:

Code:
import java.awt.Graphics;
import java.awt.Font;
import java.awt.Color;

public class firstApplet extends java.applet.Applet {
    
    Font f = new Font("TimesRoman",Font.BOLD,36);
    
    public void paint(Graphics g) {
        g.setFont(f);
        g.setColor(Color.red);
        g.drawString("Hello World", 5, 50);
    }
}
and my HTML file:


Code:
<HTML>
<HEAD>
   <TITLE>Applet HTML Page</TITLE>
</HEAD>
<BODY>

<H3><HR WIDTH="100%">Applet HTML Page<HR WIDTH="100%"></H3>

<P>
<APPLET codebase=.. code="firstApplet.class" width=350 height=200></APPLET>
</P>

<HR WIDTH="100%"><FONT SIZE=-1><I>Generated by NetBeans IDE</I></FONT>
</BODY>
</HTML>
I have been struggling to get my java applets to load. I eventually got the plugin installed correctly in Konqueror(I used to get a message saying the java plugin wasn't initialized), but now I am not able to load my applets.

I tried a second method to view the applets, I used the "appletviewer" that comes with the java SDK. Here is my out put:

[mike@localhost firstApplet]$ appletviewer firstApplet.html
java.lang.NoClassDefFoundError: firstApplet/firstApplet (wrong name: firstApplet)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:157)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:123)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:561)
at sun.applet.AppletPanel.createApplet(AppletPanel.java:617)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:546)
at sun.applet.AppletPanel.run(AppletPanel.java:298)
at java.lang.Thread.run(Thread.java:534)

The appletviewer does appear, but at the bottom it says "Start: applet not initialized".

If you know of a seperate program that can view applets outside a browser's plugins, I would be more than happy to hear about it.

All help is always appreciated :-)

Thanks,
Mike
 
Old 08-28-2004, 05:52 PM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
appletviewer worked for me with both your applet and html only after I replaced codebase=.. by codebase="."
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Java plugin installed correctly for Firefox but not able to view any java applet tvn Linux - Software 10 04-15-2010 02:13 AM
"Add/Remove Applications" applet issue tom_from_van Linux - Newbie 5 07-23-2005 02:07 AM
Java error "Exception in thread "main" java.lang.StackOverflowError" nro Programming 1 09-04-2004 03:47 AM
removing "Java Applet window" label blahJake Programming 3 06-14-2004 01:22 PM
does failed using urpmi messed up my "Install Software" / "mandrake update" ??? sirpelidor Mandriva 1 11-02-2003 09:00 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration