• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HTML wont run Applet

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all...I am trying to run an applet through an html page in eclipse. The applet runs fine but no when being called in from the html file. I have my HTML file located under the "JRE System Library". My java file is located in a package I created. Below is the HTML code I am using to call the applet. When opening file with browser in eclipse it shows a blank screen. I tried navigating to the file path of the html file and when opening it there is an empty box in the middle of the browsers after I allow activex to run. What am I missing?

<html>
<head>
<title>Simple Applet</title>
</head>
<body>
<APPLET code="Simple.class" binwidth="350" height="350"></APPLET>
</body>
</html>
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Dwayne Brown wrote:I have my HTML file located under the "JRE System Library".



Don't do that. Don't put anything in that library. Set up a separate directory for your code and data.

My java file is located in a package I created.



But your HTML code looks for an applet which is not in a package.

Below is the HTML code I am using to call the applet.



Since the HTML file doesn't say otherwise, the browser expects to download the applet from the same directory as it downloaded the HTML file from. (Of course, since your applet is in a package, it's the package root which the browser will expect to be in the same directory as the HTML.)

You mentioned Eclipse? Sure, Eclipse is good for testing applets, but when you go to implement the applet, forget about Eclipse altogether. You're going to be serving the HTML and the applet from a web server, where Eclipse won't be around. So you should set up things -- outside Eclipse -- in the same way as you're going to set them up when you deploy them to your web server.
 
Dwayne Brown
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your time Paul. In every tutorial from youtube to Java books show the same way to place the html file. I deleted my HTML file and created a new one in the same directory. In the same directory I am not getting anything to show but in the default area for the project it will at least show the red X for the applet and the html text. I have activex enabled in my browser (IE9). I even tried chrome but nothing is working.

Below is the error message I am getting when running the applet in IE9.


Java Plug-in 10.1.0.8
Using JRE version 1.7.0_01-b08 Java HotSpot(TM) 64-Bit Server VM
User home directory = C:\Users\MyDirectory
----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------
Detected from bootclasspath: C:\\PROGRA~1\\Java\\jre7\\lib\\deploy.jar

 
Dwayne Brown
Greenhorn
Posts: 13
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I finally figured it out.



My full package name was test. It should have been set as this:



reply
    Bookmark Topic Watch Topic
  • New Topic