Results 1 to 17 of 17
  1. #1
    Konrad is offline Member
    Join Date
    Sep 2014
    Posts
    9
    Rep Power
    0

    Default Adding external libraries to applet in the browser, NoClassDefFoundError

    I've read a lot of discussion about similar topics but I still can't find the solution of my problem. I wrote a simple applet which reads from excel file using POI libraries. It works well in eclipse and in appletviewer but I still have problem when I try to run it in the browser (chrome). I compiled applet with adding external libraries: xmlbeans-2.6.0, poi-3.10.1-20140818 and some other. After that I created jar file in some directory. Then I made a html file:

    Java Code:
        <html> 
        <body> 
        <applet 
         code="Read.class" 
         archive="Read.jar,poi-3.10.1-20140818.jar,poi-ooxml-3.10.1-20140818.jar, poi-ooxml-schemas-3.10.1-20140818.jar, dom4j-1.6.1.jar, xmlbeans-2.6.0.jar" 
         width="1100" height="800"> 
        </applet> 
        </body> 
        </html>
    And finally I copied jar libraries in to folder with my jar applet. With everything in the same folder I tried to open it in chrome but this error apeared:

    NoClassDefFoundError
    org/apache/xmlbeans/XmlObject
    I looked at xmlbeans jar but this path exist, so It should be visible for an applet. When I checked details this message appeared:

    CacheEntry[file:/C:/Users/OEM/Desktop/proby/Ostatni/Read.jar]: updateAvailable=false,lastModified=Tue Sep 09 16:00:06 CEST 2014,length=11520
    0
    CacheEntry[file:/C:/Users/OEM/Desktop/proby/Ostatni/poi-3.10.1-20140818.jar]: updateAvailable=false,lastModified=Wed Aug 13 23:41:22 CEST 2014,length=1949542
    CacheEntry[file:/C:/Users/OEM/Desktop/proby/Ostatni/poi-ooxml-3.10.1-20140818.jar]: updateAvailable=false,lastModified=Wed Aug 13 23:41:24 CEST 2014,length=1035419
    CacheEntry[file:/C:/Users/OEM/Desktop/proby/Ostatni/dom4j-1.6.1.jar]: updateAvailable=false,lastModified=Wed Aug 13 14:44:08 CEST 2014,length=313898
    Java Plug-in 10.67.2.01
    Using JRE version 1.7.0_67-b01 Java HotSpot(TM) Client VM
    User home directory = C:\Users\OEM
    ----------------------------------------------------
    I don't know how to remove this problem. I tried to give all paths to libraries like:
    file:///C:/Users/OEM/Desktop/proby/Ostatni/xmlbeans-2.6.0.jar or even I set paths to the jar files that I used in eclipse, but it doesn't seems to work. Somebody have any ideas?

    I will be very grateful for help!
    Last edited by Konrad; 09-10-2014 at 12:01 PM.

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: Adding external libraries to applet in the browser, NoClassDefFoundError

    HOW are you running in a browser?

    The general idea is that the HTML is serviced through 'the web', in other words you need a basic webserver to be able to service that HTML; even if it is only running on the localhost. That will also cause the applet jar(s) to be downloaded through "the web" and the Java plugin sandbox will start doing its thing, which will highly likely mean that the applet will be blocked from running because of a mountain of security reasons.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    Konrad is offline Member
    Join Date
    Sep 2014
    Posts
    9
    Rep Power
    0

    Default Re: Adding external libraries to applet in the browser, NoClassDefFoundError

    Thank you very much for your reply!

    So, if I understand you well I should upload all my files on webserver, and try to launch applet from there. I've never done such a thing - could you give me a link to some tutorials or give me some hint where I can learn more about it?

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    19,964
    Rep Power
    31

    Default Re: Adding external libraries to applet in the browser, NoClassDefFoundError

    You should be able to test the html from a local folder without a server. However, I haven't tried it lately to be sure it would work.
    If you don't understand my response, don't ignore it, ask a question.

  5. #5
    Konrad is offline Member
    Join Date
    Sep 2014
    Posts
    9
    Rep Power
    0

    Default Re: Adding external libraries to applet in the browser, NoClassDefFoundError

    Thank you for your answer!

    That's what I thouht so, but apparently I'm not able to test it from local folder. I guess I should try this on webserwer - I don't have any other ideas.
    Last edited by Konrad; 09-12-2014 at 01:19 PM.

  6. #6
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: Adding external libraries to applet in the browser, NoClassDefFoundError

    Its become a very vague subject with all the security changes that have been done :/ May I ask why you want to bother yourself (and worse: the people who will have to use it) with an applet?
    Last edited by gimbal2; 09-12-2014 at 11:00 AM.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  7. #7
    Konrad is offline Member
    Join Date
    Sep 2014
    Posts
    9
    Rep Power
    0

    Default Re: Adding external libraries to applet in the browser, NoClassDefFoundError

    I just want to write a calculator which will help users to choose the best wind turbine on the market. I have some basic knowledge about java language, so I decided to write an applet - I thought that is the easiest way to do such a thing, but now I'm not sure about that :)
    What should I do instead of an applet? I'm new in subject of web aplications, so any advice will be helpfull!
    Last edited by Konrad; 09-12-2014 at 01:56 PM.

  8. #8
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: Adding external libraries to applet in the browser, NoClassDefFoundError

    No, applets are a complete nightmare for both you and the end-user. Lots of people disable Java in their browsers nowadays too because of the "security leak" assault in the media surrounding it in the past year which has given Java a really bad name among regular consumers. You wouldn't be giving yourself a good name to choose for using an applet nowadays.

    Much rather what the people would expect is an app for their mobile phones. But you might be able to just use "HTML 5" to do this.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  9. #9
    Konrad is offline Member
    Join Date
    Sep 2014
    Posts
    9
    Rep Power
    0

    Default Re: Adding external libraries to applet in the browser, NoClassDefFoundError

    Sorry for such a late reply. I'm not a specialist, but I thought that "HTML 5" is good for making GUI, but how can I carry out numerical calculations in it?

  10. #10
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: Adding external libraries to applet in the browser, NoClassDefFoundError

    "HTML 5" = Javascript.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  11. #11
    Konrad is offline Member
    Join Date
    Sep 2014
    Posts
    9
    Rep Power
    0

    Default Re: Adding external libraries to applet in the browser, NoClassDefFoundError

    Thank you for your patience. In that case, I will try to learn JavaScript.

  12. #12
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: Adding external libraries to applet in the browser, NoClassDefFoundError

    Disclaimer: I was giving possibilities, I was not telling you what to do. I do hope you will make up your own mind rather than just going to learn Javascript because I said it was a possibility.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  13. #13
    Konrad is offline Member
    Join Date
    Sep 2014
    Posts
    9
    Rep Power
    0

    Default Re: Adding external libraries to applet in the browser, NoClassDefFoundError

    Of course, I understand, but this solution seems resonable. If you see any other way to do it, then tell me, and I will take it into consideration :)

  14. #14
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: Adding external libraries to applet in the browser, NoClassDefFoundError

    Well then we're on the same page ;)

    If you want other possibilities you'll have to explain more about what you want to achieve. What is your purpose for making this? Learning? School? To make money? Is this just a helpful tool to be shared with known clients, or is it for everyone on the world?

    Speaking of which : who exactly do you target with program?

    Those are the kind of details that really are the determining factor for which solutions you pick.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  15. #15
    Konrad is offline Member
    Join Date
    Sep 2014
    Posts
    9
    Rep Power
    0

    Default Re: Adding external libraries to applet in the browser, NoClassDefFoundError

    Ok. So in optimistic scenario it is for "everyone on the world". This application should promote renewable energy, and if everything will work fine, this program should be upload on website of institute in which I have internship.
    Last edited by Konrad; 09-16-2014 at 05:46 PM.

  16. #16
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: Adding external libraries to applet in the browser, NoClassDefFoundError

    Sounds like a job for a simple web application then, yes. If that can be pure HTML 5 + Javascript, I don't know. It can work just as well with a 'traditional' server side web application built using a Java web framework such as Apache Wicket, JSF 2.2, Spring MVC or Struts 2. But pure HTML 5 might just be a shorter learning path for you and can work on any web server.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  17. #17
    Konrad is offline Member
    Join Date
    Sep 2014
    Posts
    9
    Rep Power
    0

    Default Re: Adding external libraries to applet in the browser, NoClassDefFoundError

    Thank you again! I will see what I can do!

Similar Threads

  1. Adding external archives?
    By Dark Knight in forum New To Java
    Replies: 1
    Last Post: 04-21-2014, 12:49 PM
  2. Compiling with external libraries
    By sublixt in forum New To Java
    Replies: 5
    Last Post: 05-04-2012, 06:17 PM
  3. Replies: 0
    Last Post: 11-17-2011, 04:52 AM
  4. How to force applet to use libraries?
    By Arvutis6ber in forum Java Applets
    Replies: 1
    Last Post: 09-20-2010, 02:24 PM
  5. Replies: 1
    Last Post: 11-04-2009, 02:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •