Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

applet and the html file in separate directory

 
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
 
High Plains Drifter
Posts: 7289
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
Posts: 7289
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).]
 
Aaaaaand ... we're on the march. Stylin. Get with it tiny ad.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic