Re: Beginner Eclipse problem

From: Denise Howard (dhowar..gp.com)
Date: Tue Sep 28 2004 - 13:30:57 EDT

  • Next message: Denise Howard: "Re: Beginner Eclipse problem"

    Thanks for the suggestions, guys, but this doesn't quite solve my problem.
    If I'm on an OS X machine and my boss--who will be using the application jar
    I create--is on a Windows machine, the classpaths will be entirely
    different. Not only that but he will not have Axis installed, so he won't
    have any of those necessary jars. How do I create an application jar that
    1) I can run outside of Eclipse, and 2) I can hand off to someone in a
    different environment to use? They shouldn't have to install anything other
    than my application jar.

    Denise

    On 9/28/04 7:11 AM, "JR Ruggentaler" <JR.Ruggentaler@mpv.com> wrote:

    > Jars can also include a "CLASSPATH" in the Manifest.mf with relative or fixed
    > paths, for example:
    > Class-Path: ../libs/activation.jar ../libs/classes111.zip
    >
    > Using Class-Path and Main-Class allows the application when packaged as a jar
    > to be launchable by clicking the jar on MS Windows and probably other OSs. See
    > the JDK Docs on Jars for complete explanation.
    >
    > -----Original Message-----
    > From: Jason Dwyer [mailto:Jason.Dwyer@redata.com.au]
    > Sent: Tuesday, September 28, 2004 2:55 AM
    > To: woproject-dev@objectstyle.org; dhoward@pgp.com
    > Subject: Re: Beginner Eclipse problem
    >
    >
    > hi denise,
    >
    > theres a number of ways to include the relevant jars into your
    > classpath, its not an eclipse issue per se, as much as it is part and
    > parcel of any java app which relies on multiple libraries
    >
    > probably the cleanest method will be to write an ant target which
    > invokes java.
    >
    > another would be to write a short shell command which sets up a local
    > variable to hold a list of jars.
    >
    > put this into a file called starter.sh: (or whatever)
    >
    > #!/bin/sh
    > for i in $1/*.jar; do
    > export MYPATH=$MYPATH:$i
    > done
    >
    > java -cp $MYPATH $2
    >
    > ====cut here===
    > ensure its executable (chmod 755 starter.sh)
    >
    > then invoke with 2 parameters:
    >
    > ./starter.sh <path_to_libs_dir> <fully_qualified_java_class>
    >
    > i've assumed your java libraries (jars) for the project are in one local
    > directory, which you pass in as the first arg. if not, its a good
    > practice: makes it easier to keep track of which libs ( and versions of
    > libs) you are using.
    >
    > still, probably better to look into ant to manage all this for you.
    >
    > .. and while its possible to 'merge' the contents of jars into your own
    > application's jar, you really dont want to be doing that...
    >
    > regards,
    >
    > j.dwyer
    > redata software systems
    >
    >
    >
    > On Tue, 2004-09-28 at 12:20, Denise Howard wrote:
    >> I hope this is a quick and easy one. I'm running Eclipse 3.0.1 on Mac OS X
    >> 10.3.5. In Eclipse I can run my plain Java application to my heart's
    >> content. It happens to use Apache Axis, so all those Axis jars are in the
    >> build path.
    >>
    >> Then I use Eclipse to create a jar file for my application, and from the
    >> command line I try to run the jar, and right off the bat I get a
    >> "NoClassDefFoundError" for one of the Axis classes. Spelling out the
    >> classpath (I copied and pasted from Eclipse's command line inspector so I
    >> know they're all spelled and punctuated correctly) made no difference.
    >>
    >> What am I doing wrong? The Eclipse help system is wonderful but I couldn't
    >> find quite the solution in it for this. Is there a way to have Eclipse
    >> "copy" external jars (such as these Axis ones) into my application jar so
    >> that I can hand it to someone who doesn't have Axis installed and it will
    >> run for them (similar to the "merge" in Xcode)?
    >>
    >> Thanks--
    >>
    >> Denise
    >>
    >>
    >>
    >> ________________________________________________________________
    >> This message could have been secured by PGP Universal. To secure
    >> future messages from this sender, please click this link:
    >>
    >> woproject-dev@objectstyle.org">https://keys.pgp.com/b/b.e?r=woproject-dev@objectstyle.org
    >>

    ________________________________________________________________
    This message could have been secured by PGP Universal. To secure
    future messages from this sender, please click this link:

    woproject-dev@objectstyle.org">https://keys.pgp.com/b/b.e?r=woproject-dev@objectstyle.org



    This archive was generated by hypermail 2.0.0 : Tue Sep 28 2004 - 13:31:08 EDT