?
Solved

Hello world applet cant load in browser but able to load in appletviewer

Posted on 2003-02-20
9
Medium Priority
?
275 Views
Last Modified: 2013-11-23
i try to load my helloworld but it cant load in IE but it manage to load in appletviewer. i have alreadi read thru some of the simalar question but it doesnt help cox it say swing plugin but for tis simple hello world ther not even a swing plug in. thanks if any of you can help me check thru the code

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

public class graph extends Applet {
   public void paint(Graphics g) {
      Font font = new Font ("SansSerif", Font.BOLD, 26);
      g.setFont(font);
      g.drawString("Hello world!", 50, 25);
   }
}
--------------HTMl FILE----------------
<HTML>
<HEAD>
<TITLE> Hello World </TITLE>
</HEAD>
<BODY>
<font size = +5>
Here is Hello World1 applet:<br>
<APPLET CODE="graph.class" WIDTH=500 HEIGHT=25>
</APPLET>
</font>
<br>
<p>
</BODY>
</HTML>
------------------------------------
all of them reside in the same folder say C:\test  
0
Comment
Question by:crappy35
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 

Expert Comment

by:suryakumar
ID: 7986081
Add the comment shown and recompile the class and then open the HTML file in a browser

/*<applet code="graph.class" width=500 height=25></applet> */
import java.applet.Applet;
import java.awt.*;

public class graph extends Applet {
  public void paint(Graphics g) {
     Font font = new Font ("SansSerif", Font.BOLD, 26);
     g.setFont(font);
     g.drawString("Hello world!", 50, 25);
  }
}

0
 
LVL 3

Expert Comment

by:schybert
ID: 7986084
What error message do you get?
0
 

Author Comment

by:crappy35
ID: 7986178
it says load: class graph not found
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Expert Comment

by:davestubbs
ID: 7986755
The class file MUST be in the same directory on the server as the page from which you loaded it.

You also do not need to specify the .class, so just use

<APPLET CODE="graph" WIDTH=500 HEIGHT=25>
0
 

Author Comment

by:crappy35
ID: 7987844
ok there noting wrong with the coding becos i manage to test it on my laptop and it works but it doesnt work on the desktop ...what could possibly be the reason?
0
 
LVL 14

Expert Comment

by:Tommy Braas
ID: 7988192
Are you creating a jar with your class file? If so, you need to specify the 'archive' parameter.
0
 

Author Comment

by:crappy35
ID: 7990973
nope no jar..
0
 

Accepted Solution

by:
drumkit17 earned 150 total points
ID: 7991307
try installing reinstalling run time enviroment for jdk
0
 

Author Comment

by:crappy35
ID: 7991319
ya i manage to slove the problem, is either i reinstall jdk runtime new version or i recompile the applet in jdk1.2 version. and it works
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month8 days, 2 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question