LinuxQuestions.org
Review your favorite Linux distribution.
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 01-21-2003, 10:57 AM   #1
jetblackz
Member
 
Registered: Mar 2002
Location: Debian Galaxy
Distribution: Debian
Posts: 711

Rep: Reputation: 30
Java Appletviewer...


appletviewer MyFirstApplet.html
*nothing returned nothing shown*
--

appletviewer -debug MyFirstApplet.html
> run
run sun.applet.Main MyFirstApplet.html
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
>
VM Started:
The application exited
--

MyFirstApplet.html
Code:
<html>
  <head>
    <title>MyFirstApplet</title>
  </head>
  <body>
    <hr>
    <applet code="MyFirstApplet.class" width=300 height=200>
    <hr>
  </body>
</html>
--

MyFirstApplet.class
Code:
import javax.swing.JApplet;
import java.awt.Graphics;

public class MyFirstApplet extends JApplet {

  public void paint(Graphics g) {
    g.drawString("To climb a ladder, start at the bottom rung", 20, 90);
  }
}
--

Source: Java 2, Wrox
Tools: vi & Sun's Java SDK 1.4.1

Q: how do you normally test an applet? Any errors in my code & html?

Mozilla 1.2.1 & the same SDK doesn't run it either. A red cross on the top-left.
 
Old 01-21-2003, 11:28 AM   #2
oulevon
Member
 
Registered: Feb 2001
Location: Boston, USA
Distribution: Slackware
Posts: 438

Rep: Reputation: 30
You don't have an init() method, so it won't run. Applications need a main() method, Applets need an init() method.


Appletviewer isn't working on my computer either (I've never used it). Buf if I check the applet through my web browser (Galeon), it works fine after you add the init method.


Last edited by oulevon; 01-21-2003 at 11:31 AM.
 
Old 01-24-2003, 10:16 AM   #3
macewan
Senior Member
 
Registered: Jan 2002
Distribution: Ubuntu, Debian
Posts: 1,055
Blog Entries: 1

Rep: Reputation: 45
http://java.sun.com/docs/books/tutor...va/unix.html#3
 
Old 01-24-2003, 11:50 AM   #4
jetblackz
Member
 
Registered: Mar 2002
Location: Debian Galaxy
Distribution: Debian
Posts: 711

Original Poster
Rep: Reputation: 30
And to think I had to shell out 60 bones for a book half as thick as my PC tower...

Thanks very much!
 
  


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
Java Programming: Java Runtime Environment not found when trying to compile murbz Linux - Software 2 03-26-2009 03:04 AM
Web start java not working (java works fine) powadha Debian 5 06-05-2004 12:57 PM
Java AppletViewer DavidTempler Programming 6 04-08-2004 12:22 PM
2 Questions: java calling system commands? PERL vs Java? randomx Programming 28 11-28-2003 08:24 PM

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

All times are GMT -5. The time now is 03:16 PM.

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