aspose file tools*
The moose likes Applets and the fly likes applet and the html file in separate directory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "applet and the html file in separate directory" Watch "applet and the html file in separate directory" New topic
Author

applet and the html file in separate directory

sushant prabhu
Ranch Hand

Joined: Mar 22, 2001
Posts: 66
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


Sushant Prabhu<br />SCJP2<br />SCWCD<br />OCA9i
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

Could you show the HTML you are using?
------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
sushant prabhu
Ranch Hand

Joined: Mar 22, 2001
Posts: 66
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

Joined: Oct 25, 2000
Posts: 7292

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).]
 
 
subject: applet and the html file in separate directory