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?
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 testingapplets, 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.
Joined: Jan 16, 2012
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
Joined: Jan 16, 2012
I finally figured it out.
My full package name was test. It should have been set as this: