I've made an applet that uses a .jar file loaded on my computer. If I try to run the applet on someone elses computer that does have java installed but not the .jar file, its just a gray box. How can I fix this?
Printable View
I've made an applet that uses a .jar file loaded on my computer. If I try to run the applet on someone elses computer that does have java installed but not the .jar file, its just a gray box. How can I fix this?
Add that JAR to the JAR which contains the applet.
OK sorry I probably worded that wrong. What I have is a .class file for a website--an applet. It imports a library in a .jar file format, and the applet works fine on my computer. But on any other computer that doesn't have that .jar file, it just appears as a gray box. I've tried uploading the .jar file to my server, but no luck there either. Any thoughts???
P.S.-I'm kinda new to applets, so I could just be missing something obvious.
Create a NEW .jar file, add the .class file and the .jar library file to this NEW .jar file.
Look at Sun's tutorials on their website (http://java.sun.com) on creating JARs, but it should look somethign like this:
jar -cvf new.jar MyApplet.class library.jar
OK thanks for your help, etc. I found this really good one on creating .jar files if anyone else is curious: Here
Well I'm back again...I still can't get it to work. I put the .class and .jar into a .jar and used the following applet code:
<applet code=MyClass.class archive="MyJar.jar" width=400 height=300>
</applet>
Now again that works on my computer but not the others. I tried re-installing the JVM-no luck. I tried rebuilding the .jar-no luck. I tried uploading the original .class, .jar, and the new .jar again in binary-no luck-also in ASCII-no luck. I restarted the computer-no luck. I just can't figure out whats wrong. Anyone got any ideas? It's driving me insane...:mad:
What's the URL?
http://www.ogamas.us/java/PigLatin/index.html The java directory is just kinda my testing directory so you won't find much there in case you were wondering...
You can clearly see the error in the java console.
java.lang.NoClassDefFoundError: BreezySwing/GBApplet
Is that a class you are using? If so add it to your jars.
Yes that is a class I'm using but I didn't see that error on my other computer where it didn't work...I did what arch told me to do and put the .class and the BreezySwing.jar into a .jar file together but it still didn't work. Is there anything else I should be doing?
Add the external jar to the applet archive attribure:
archive="MyJar.jar,BreezySwing.jar"
THANK YOU THANK YOU to INIFINITI and beyond. Adding the BreezySwing.jar to the archive worked!!! I can't thank the both of you enough for helping. THANK YOU VERY MUCH!!!!!:D
Happy to assist :)