Results 1 to 15 of 15
Thread: [SOLVED] JAR applet won’t load.
- 09-05-2008, 09:08 PM #1
Member
- Join Date
- May 2008
- Posts
- 26
- Rep Power
- 0
[SOLVED] JAR applet won’t load.
Hello,
I recently sign an Applet after archiving it with the Eclipse’s IDE and it worked fine when loading it from a local HTML file on the hard drive. But when I upload it to the web server, it can’t fine the Class file.
Here is the link:Here is the class:Java Code:mzw3.com/Control/Signed/
HTML Code:Java Code:import javax.swing.*; import java.applet.Applet; public class VNC extends Applet { /** * */ private static final long serialVersionUID = 1L; public void init() { JOptionPane.showMessageDialog(null, "Hello, World!"); } }
Both the HTML and JAR file are in the same directory. Any help will be greatly appreciated!Java Code:<applet code="VNC.class" archive="VNC.jar" width="100%" height="100%"></applet>
- 09-06-2008, 12:24 AM #2
Are there any messages in the browser's java console?
Copy and paste them here.
- 09-06-2008, 01:50 AM #3
Member
- Join Date
- May 2008
- Posts
- 26
- Rep Power
- 0
Error:
Java Code:load: class VNC.class not found. java.lang.ClassNotFoundException: VNC.class at sun.applet.AppletClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.applet.AppletClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.applet.AppletClassLoader.loadCode(Unknown Source) at sun.applet.AppletPanel.createApplet(Unknown Source) at sun.plugin.AppletViewer.createApplet(Unknown Source) at sun.applet.AppletPanel.runLoader(Unknown Source) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.io.IOException: open HTTP connection failed. at sun.applet.AppletClassLoader.getBytes(Unknown Source) at sun.applet.AppletClassLoader.access$100(Unknown Source) at sun.applet.AppletClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) ... 10 more
- 09-06-2008, 03:02 AM #4
Looks like the jvm is looking for a class: VNC.class
instead of the class VNC.
Leave the .class off the code= attribute.
- 09-06-2008, 03:38 AM #5
Member
- Join Date
- May 2008
- Posts
- 26
- Rep Power
- 0
Same error:
How do you turn your class into a JAR file? Maybe I am doing something wrong. And what about this part:Java Code:load: class VNC not found. java.lang.ClassNotFoundException: VNC at sun.applet.AppletClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.applet.AppletClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.applet.AppletClassLoader.loadCode(Unknown Source) at sun.applet.AppletPanel.createApplet(Unknown Source) at sun.plugin.AppletViewer.createApplet(Unknown Source) at sun.applet.AppletPanel.runLoader(Unknown Source) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.io.IOException: open HTTP connection failed. at sun.applet.AppletClassLoader.getBytes(Unknown Source) at sun.applet.AppletClassLoader.access$100(Unknown Source) at sun.applet.AppletClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) ... 10 more
Java Code:Caused by: java.io.IOException: open HTTP connection failed.
Last edited by Master Zero; 09-06-2008 at 03:56 AM.
- 09-06-2008, 02:28 PM #6
What are the contents of the VNC.jar file? The VNC.class file should be at the root level.
That looks like the reason the class file was not read. I don't know why you would get that.open HTTP connection failed.
I tried your site and get the same error.
The html that is loaded is missing the beginning parts. It starts with the <APPLET tag. It ends with an https URL reference.
Try making a complete/correct HTML page with all the body, head and ending tags.
I think there is a problem getting your jar file from the server. When I tried to read it, I get the following. The first part below is in HEX, below that is in text :
If you open a jar file in a hex editor the first few bytes are as follows:504B 0304 14 3C2F6F626A6563743E....
PK...</object></layer></span></div></table></body></html><!-- adsok -->..<script language='javascript' src='https://a12.alphagodaddy.com/hosting_ads/gd01.js'></script>..
504B 0304 14 00Last edited by Norm; 09-06-2008 at 04:09 PM.
- 09-06-2008, 04:54 PM #7
Member
- Join Date
- May 2008
- Posts
- 26
- Rep Power
- 0
Ok, I renamed VNC.jar to VNC.zip to look at the contents inside. They are as follow:
VNC.zip (jar):
- META-INF (folder)
- VNC.class
META-INF
- MANIFEST.MF
- MZW3.RSA
- MZW3.SF
I renamed it back to .jar and made sure it still worked by double clicking it and I got the "hello, world!" message box.
I redesigned the html file to include every HTML tag there should be for a normal document. What troubles me is that it works fine as a regular class (once uploaded). So it possible that it is not even looking inside the jar file for the class?
- 09-06-2008, 06:03 PM #8
Did you try reading the jar file on the server and looking at the contents of what you get? I'm sure the jar file on your disk is OK if the applet is loaded from it using local html file.
What does that mean?it works fine as a regular class(once uploaded)
You originally said:
Is that no longer true now? Does it now "fine the Class file"?But when I upload it to the web server, it can’t fine the Class file.
Does that mean the problem is only when the class file is in a jar file?
Are you able to download the jar file from the server? Does your server support downloading jar files?Last edited by Norm; 09-06-2008 at 06:30 PM.
- 09-06-2008, 06:49 PM #9
Member
- Join Date
- May 2008
- Posts
- 26
- Rep Power
- 0
No, I tried uploading just the VNC.class to see if it would work and it did, so I uploaded the jar which of course did not work, it seems that the jar file is not being acknowledged, thus the browser may not be looking inside the jar for the class (I could be wrong).
So yes, there is a problem when the class is inside the jar.
Ok, I don’t know how to check the contents of a jar file on the server so I downloaded it back to my hard drive, and it still does load in a local HTML.
I have zip up both the class and jar in case you may want to look at it yourself, and try it out.
Thank you for your help and patients thus far.Java Code:mzw3.com/Control/Signed/VNC.zip
Last edited by Master Zero; 09-06-2008 at 06:56 PM.
- 09-06-2008, 08:41 PM #10
I used this URL to load your jar file from the server:
http://mzw3.com/Control/Signed/VNC.jar
When I used the above in my browser and saved the jar to a local file, its contents were as I described above.
Does your server support downloading jar files via HTML <applet tags?
- 09-06-2008, 10:20 PM #11
Member
- Join Date
- May 2008
- Posts
- 26
- Rep Power
- 0
I am using GoDaddy to host my file. I’ll do some research and see if it does support it.
- 09-06-2008, 10:40 PM #12
Try renaming your VNC.jar file to VNC.zip and change your html to use it: archive=VNC.zip.
- 09-06-2008, 10:49 PM #13
Member
- Join Date
- May 2008
- Posts
- 26
- Rep Power
- 0
Ok so I spoke to a representative and he told me that I can’t do it on a shared hosting account. So I guessed that solved the problem. Would you by any chance know of a good hosting company that I can check out? Godaddy’s dedicated servers are quite expensive.
- 09-06-2008, 10:55 PM #14
Member
- Join Date
- May 2008
- Posts
- 26
- Rep Power
- 0
- 09-06-2008, 11:10 PM #15
google has free space for simple files, but doesn't allow making folders so everything is in the same folder. It does allow HTML to use jar files. For example: This page loads an applet that tries to read a file from your C: drive. Its signed and causes a prompt asking for permission.
Applet Reader
Similar Threads
-
Java Security Applet will not load under a specific user.
By MartyF in forum Java AppletsReplies: 0Last Post: 03-31-2008, 04:35 PM -
Load URL that contains spaces?
By barkster in forum Java AppletsReplies: 0Last Post: 01-30-2008, 09:40 PM -
how to load a lot of files?
By gabriel in forum Java ServletReplies: 1Last Post: 08-07-2007, 06:04 PM -
Help with load image
By trill in forum New To JavaReplies: 1Last Post: 08-01-2007, 07:16 AM -
load a document to the server
By Heather in forum JavaServer Pages (JSP) and JSTLReplies: 2Last Post: 06-29-2007, 02:08 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks