Welcome to Geeklog, Anonymous Sunday, December 22 2024 @ 12:33 pm EST

Geeklog Forums

Running a Java Applet from a Static Page


Status: offline

johnjr

Forum User
Chatty
Registered: 02/08/04
Posts: 68
I'm trying to run this Java Applet from a static page:

Text Formatted Code

<p><applet name="morse" code="smorse.class" width="540" height="400"
 align="bottom" vspace="1"> <param name="TEXT" value="cq "> <param
 name="WPM" value="13"> </applet> </p>

 


The applet always fails to load.

I've placed the 'smorse.class' file in the main 'public' directory, as well as in the staticpages subdirectory, but to no avail.

Any suggestions on how to get this to work?

John
 Quote

Status: offline

jmucchiello

Forum User
Full Member
Registered: 08/29/05
Posts: 985
I've never tried this but you should probably give a complete path to the class in the code attribute. Also are you sure that's the name of the class? Most java classes have names like com.example.TheClass.
 Quote

Status: offline

johnjr

Forum User
Chatty
Registered: 02/08/04
Posts: 68
Yes, that's the name of the class. The code works fine in an html file, with the class file in the same directory as the html file.

And I've tried setting the path, both as a URL and as a 'file path' on the server. It still doesn't work.

John
 Quote

Status: offline

johnjr

Forum User
Chatty
Registered: 02/08/04
Posts: 68
I got it figured out. To load a Java applet from another location, the keyword 'Codebase' must be used, such as here:

align="bottom" vspace="1"> name="WPM" value="13">

The Java applet runs fine in a static page.

John
 Quote

All times are EST. The time is now 12:33 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content