Results 1 to 6 of 6
  1. #1
    CaleyM is offline Member
    Join Date
    Oct 2012
    Posts
    4
    Rep Power
    0

    Default Executable Jar Not Finding Libraries

    How do you build an executable jar with Eclipse that actually finds the required libraries...? I did export->jar file, then I tried putting the library jars just about everywhere other than Timbuktu. It never gets past loading from the required library the class that my main class extends.
    Last edited by CaleyM; 10-02-2013 at 09:50 AM.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,949
    Rep Power
    19

    Default Re: Executable Jar Not Finding Libraries

    Export->runnable jar-> select copy required libraries into sub-folder.
    That will create a jar file, with all the files ina <jar name>-lib directory, and a manifest class path entry pointing to those dependencies.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    CaleyM is offline Member
    Join Date
    Oct 2012
    Posts
    4
    Rep Power
    0

    Default Re: Executable Jar Not Finding Libraries

    Quote Originally Posted by Tolls View Post
    Export->runnable jar-> select copy required libraries into sub-folder.
    That will create a jar file, with all the files ina <jar name>-lib directory, and a manifest class path entry pointing to those dependencies.
    There's no such option as runnable jar in my version. Is that a newer version feature or do I have a package that does not include it? Mine is 3.3.2 and the standard one available now says 4.3.1. I guess I should use the search for updates option.
    Last edited by CaleyM; 10-02-2013 at 07:26 PM.

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,949
    Rep Power
    19

    Default Re: Executable Jar Not Finding Libraries

    The equivalent will be in there.
    It's been there almost since the beginning.
    It may be an option on the jar file export.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

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

    Default Re: Executable Jar Not Finding Libraries

    I must say that I loathe the jar export function of Eclipse - one of the very few things I absolutely do not like about the IDE. In that respect Netbeans does it much better. I would use an ANT or Maven based Eclipse project so Eclipse is taken out of the packaging cycle. It has a learning curve, but the eventual development ease and independence of tools (except for ANT or Maven) is hard to beat.

    In any case I would recommend to upgrade Eclipse to at least 3.7 because it is an awesomely stable and fast version (but I have no problems with Keppler either). When you do figure out how to create an executable jar, you can check inside the jar in the META-INF/MANIFEST.MF to figure out where the dependency jars are supposed to be. If the class-path line says something like 'lib/somedep.jar', then the libraries are supposed to be in a lib subdirectory in the same folder as where the main application jar is. Or:

    myapp.jar
    lib/somedep.jar
    lib/someotherdep.jar
    etc.

    People have used a solution called 'onejar' to mash all the dependencies into one big jar, but you have to be careful with that. You could be breaking licenses if you do that.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  6. #6
    CaleyM is offline Member
    Join Date
    Oct 2012
    Posts
    4
    Rep Power
    0

    Default Re: Executable Jar Not Finding Libraries

    An update server was faulty or something. I end just downloading the latest 151mb version. That gave me the runnable jar option in that menu, but it still did squat about the natives for LWJGL. I found the solution for that on their forum, a batch file with this line pointing to a relative path:

    Java Code:
    java -Djava.library.path="natives" -jar SIC.jar
    The other option was setting the path within the program before the library is used.

Similar Threads

  1. jpcap libraries
    By misteryuku in forum Networking
    Replies: 0
    Last Post: 04-12-2012, 09:53 AM
  2. OMR class libraries
    By adwatts3537 in forum Advanced Java
    Replies: 0
    Last Post: 11-22-2011, 12:43 AM
  3. How to use libraries?
    By Josep_16 in forum New To Java
    Replies: 1
    Last Post: 09-06-2011, 01:50 PM
  4. create windows executable using executable jar file
    By sarwar1234 in forum New To Java
    Replies: 2
    Last Post: 02-07-2011, 08:29 PM
  5. How to load new libraries
    By Manfizy in forum NetBeans
    Replies: 2
    Last Post: 02-11-2009, 06:55 AM

Tags for this Thread

Posting Permissions

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