Two questions about jars

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ted Byers

    Two questions about jars

    1) I need to support installing a Java application from CD on both Windows
    AND on the Mac. I have figured out how autorun works on Windows. Is the
    method for doing this the same on the Mac as it is for Windows? I am
    thinking that what I'd do is create an install "program" (like the Setup
    program created by Install Shield on Windows), but make it as an executible
    jar file so that the Java VM on either can handle the install process. That
    way, a single CD should be able to accomodate both the Mac and Windows.

    2) I have found the process of making executible jar files a little
    problematic, and the documentation from Sun with the SDK a little lacking in
    examples: and the documentation with eclipse and Netbeans IDE is a bit of a
    maze (I'd have thought that both would make it easy to create executible
    jars, but I haven't found the relevant parts of their documentation yet, so
    I am still struggling with hat from Sun). I understand that to make a jar
    executible, I need to provide a manifest file, but I have yet to succeed in
    adding one. Can anyone point me to a simple example of making an executible
    jar containing a Swing application, or provide me with one (if that is
    simple enough)? (And/or provide a map pointing out the relevant parts of
    the documentation I have acquired) I need this jar to be self contained, so
    I do not need to worry about what version of the JRE the client machine has.

    I guess I ought to add a third question about whether or not either eclipse
    or netbean supports making a distribution as an executible jar file that
    will install the application on the client machine and create any necessary
    directories and icon on the desktop? I have found, though, a couple tools
    that should be able to do this, but I haven't been able to test them because
    I got stuck on the question of creating executible jar files.

    I am certain I can figure this out on my own, but the big problem is I am
    facing significant time pressure, so I ask for aide to help me get this
    figured out faster.

    Thanks,

    Ted


  • Raymond DeCampo

    #2
    Re: Two questions about jars

    Ted Byers wrote:[color=blue]
    >
    > 2) I have found the process of making executible jar files a little
    > problematic, and the documentation from Sun with the SDK a little lacking in
    > examples: and the documentation with eclipse and Netbeans IDE is a bit of a
    > maze (I'd have thought that both would make it easy to create executible
    > jars, but I haven't found the relevant parts of their documentation yet, so
    > I am still struggling with hat from Sun). I understand that to make a jar
    > executible, I need to provide a manifest file, but I have yet to succeed in
    > adding one. Can anyone point me to a simple example of making an executible
    > jar containing a Swing application, or provide me with one (if that is
    > simple enough)? (And/or provide a map pointing out the relevant parts of
    > the documentation I have acquired) I need this jar to be self contained, so
    > I do not need to worry about what version of the JRE the client machine has.
    >[/color]

    Suppose you want to run class com.xyz.Main. Then create a manifest file
    like this:

    ======== main.mf starts on the next line ====
    Main-Class: com.xyz.Main

    ======== end of main.mf =============== ======

    (Where the lines with === above are not actually in the file.)

    Then create your jar file:

    $ jar cvfm xyz.jar main.mf com/xyz/*.class

    Ray

    Comment

    Working...