facebook

Export to a Jar file

  1. MyEclipse IDE
  2.  > 
  3. Installation, Configuration & Updates
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #287911 Reply

    Jim Willeke
    Member

    How can I create a Jar file with the associated library files included?

    Seems to make little sense to create a jar file without the dependent library files in the Jar files.

    Certainly I am missing something.

    Thanks
    -jim

    #287927 Reply

    Loyal Water
    Member

    Jim,
    You cannot include jars while creating a JAR. This can only be achieved while creating a WAR.

    #287930 Reply

    Jim Willeke
    Member

    So how would this be accomplished?

    What use is a JAR file with no dependencies?
    Sure seems like a severe limitation.
    Thanks
    -jim

    #287975 Reply

    Loyal Water
    Member

    I think the FatJar plugin should help you achieve what you want. I’m just curious to know why you want to jar up your jars.

    #287976 Reply

    Jim Willeke
    Member

    How would you provide an application to “normal” end users?

    You think they would be able to go out an find let alone know how to incorporate all the dependent jar files?

    How else could this be done?
    Thanks
    -jim

    #287996 Reply

    ernestz
    Member

    I don’t think you can have jar files inside a jar file … maybe a Java implementation limitation. In the past, I’ve resorted to un-jaring the jars and just packing the component .class files with my .class files to create a ‘envelope’ jar file.

    You might want to look at JSmooth (http://jsmooth.sourceforge.net/). it packages your class files and supplemental jar files into a single Windows executable, which is also capable of prompting the user to download and install a JRE if none if found on the target system.

    Edit: Jumped to conclusion … the above obviously applies only if targeting a Windows environment.

    #288000 Reply

    Ton Huisman
    Member

    Usually, applications and libraries are delivered/deployed in separate jar files, where the library (mostly also .jar) files are placed in a lib subdir and the application jar files in it’s own subdir (named obj, bin, or deploy or whatever). The CLASSPATH environment variable is used to point to these directories. This is a common practice.
    Packaging all class files into a single jar is quite messy, as the jar will have very much files inside, is usually very large (monolitic application?), and makes versioning and upgrading of ‘external’ parts very difficult. Argumenting this makes delivery difficult, should make you consider your deployment strategy… Multiplatform: Have a look at InstallJammer (www.installjammer.com) or Windows: Inno Setup (www.jrsoftware.org) for a few decent, free installer tools.
    Just have a look at the MyEclipse installation directory, and you’ll see it’s ‘just a bunch of jars, scattered around in a directory structure’. Upgrading a module that unfortunately has some imperfections is an easy task 🙂
    Sun has some documentation on ‘how to deploy’, maybe that would be a good read.

    HTH
    Ton

    #288003 Reply

    Jim Willeke
    Member

    That is fine when you are delivering a “large” application with an installation method.

    A lot of what we create are very specialized applications, often “one-offs” that are often run from the command line. We provide one executable jar file with a text readme.txt file.

    Sometimes we have several apps within the same project and we only need to change the jar file to so that a different application is set to be the executable.

    Why would I want to determine and gather up what library and resource files are required when a good IDE could do the same?

    We used to use Jbuilder and it had these features.

    Looks like the “fatjar” thing will work for what we need.

    Thanks
    -jim

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: Export to a Jar file

You must be logged in to post in the forum log in