DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 13 of 13
  1. #1
    Join Date
    Sep 2003
    Posts
    18

    Applets & Libraries

    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?

  2. #2
    Join Date
    Mar 2003
    Posts
    834
    Add that JAR to the JAR which contains the applet.
    ArchAngel.
    O:-)

  3. #3
    Join Date
    Sep 2003
    Posts
    18
    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.

  4. #4
    Join Date
    Mar 2003
    Posts
    834
    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
    ArchAngel.
    O:-)

  5. #5
    Join Date
    Sep 2003
    Posts
    18
    OK thanks for your help, etc. I found this really good one on creating .jar files if anyone else is curious: Here

  6. #6
    Join Date
    Sep 2003
    Posts
    18

    Angry

    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...

  7. #7
    Join Date
    Mar 2003
    Posts
    834
    What's the URL?
    ArchAngel.
    O:-)

  8. #8
    Join Date
    Sep 2003
    Posts
    18
    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...

  9. #9
    Join Date
    Mar 2003
    Posts
    86

    NoClassDefFound

    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.

    Sharbov.

  10. #10
    Join Date
    Sep 2003
    Posts
    18
    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?

  11. #11
    Join Date
    Mar 2003
    Posts
    86

    archive=

    Add the external jar to the applet archive attribure:

    archive="MyJar.jar,BreezySwing.jar"

    Sharbov.

  12. #12
    Join Date
    Sep 2003
    Posts
    18

    Talking

    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!!!!!

  13. #13
    Join Date
    Mar 2003
    Posts
    86

    Smile Sure dude...

    Happy to assist

    Sharbov.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links