• Post Reply Bookmark Topic Watch Topic
  • New Topic

applet not inited, help me  RSS feed

 
sreenivas jeenor
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I m running applet in my web application.And i am getting the the following error."Applet org.ssl.hms.patientdemographics.dao.SecondApplet notinited".

I am ruuning applet in IE6.0 and I am using JDK1.5

when I run the same applet using command prompt.Its running fine.

Here is the code SecondApplet.java.
------------------------------------
package org.ssl.hms.patientdemographics.dao;
import java.applet.*;
import java.awt.*;

public class SecondApplet extends Applet {
static final String message = "Hello World";
private Font font;

// One-time initialization for the applet
public void init() {
font = new Font("Helvetica", Font.BOLD, 48);
}

// Draw the applet whenever necessary. Do some fancy graphics.
public void paint(Graphics g) {
// The pink oval
g.setColor(Color.pink);
g.fillOval(10, 10, 330, 100);

// The red outline. java doesn't support wide lines, so we
// try to simulate a 4-pixel wide line by drawing four ovals
g.setColor(Color.red);
g.drawOval(10,10, 330, 100);
g.drawOval(9, 9, 332, 102);
g.drawOval(8, 8, 334, 104);
g.drawOval(7, 7, 336, 106);

// The text
g.setColor(Color.black);
g.setFont(font);
g.drawString(message, 40, 75);
}
}
---------------------------

applet.html
---------------------
<html>
<body>
<center>
<p><br>

<applet
codebase="../../WEB-INF/classes/"
code="org.ssl.hms.patientdemographics.dao.SecondApplet.class"
width="300" height="370">

Oops, Your browser does not support Java applet!
</applet>

</body>
</html>



help me out to solve the problem...

Thanks
Sreenivas
[ August 16, 2007: Message edited by: sreenivas jeenor ]
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16059
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you looked at the Java console? In Internet Explorer, choose Tools / Sun Java Console. Maybe there's an exception stack trace there that tells you more.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
codebase="../../WEB-INF/classes/"

That's your problem. The servlet container will not serve any files out of the WEB-INF directory. All applet files, including classes and jar files, need to be outside of it.
 
sreenivas jeenor
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ulf Dittmer

Now a created a jarfile name PD.jar and placed it in application directory.I am Tomcat Server

tomact
|
|Webapps
|
|MyApplication
|
|PD.jar,images,jsp etc

Here is my new Applet.html
--------------------------
<html>
<body>
<center>
<p><br>

<applet
archive ="PD.jar"
code="org.ssl.hms.patientdemographics.dao.SecondApplet.class"
width="300" height="370">

Oops, Your browser does not support Java applet!
</applet>

</body>
</html>
-----------------------
Still when i run it I am getting the same message Applet org.ssl.hms.patientdemographics.dao.SecondApplet notinited.

help me
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming that the applet HTML file is now in the same directory as the PD.jar file, have you checked the Java Console for messages, like Jesper suggested? There are other reasons why an applet might not get initialized, and there'd be error messages in the Console.

You might also check the server logs, to see which file the JVM is trying to download.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!