Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

applet and the html file in separate directory

 
sushant prabhu
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to keep the applet class file and its containing html file in separate directories. when i hard code the url of the applet class in the applet tag of the html file say C:\app (is where the applet class file is and the html file is in C:\) i get the class not found error in the browsers status bar
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you show the HTML you are using?
------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide
 
sushant prabhu
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my applet code is say
import java.applet.*;
import java.awt.*;
public class myapp extends Applet
{

public void paint(Graphics g)
{
g.drawString("MyApplet",50,50);
}
}
Say this file myapp.java is in C:\app directory.

My html file
say myapp.html is in c:\

<html>
<head>
<title>using applet</title>
</head>
<body>
<applet code "C:\app\myapp.class"
width=400 height=400></applet>
</body>
</html>

 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aha, here's your problem. The tag information that you write is interpreted by the browser, which thinks "C:" is a local resource not a server resource. The browser cannot and should not assume it has root access to the file system of the server.
Instead, your CODE= value should be set relative to where the html file is found.
Try it like this: CODE=/app/myapp.class and see what that does for you.
------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide
[This message has been edited by Michael Ernest (edited December 30, 2001).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic