Re: Beginner Eclipse problem

From: Denise Howard (dhowar..gp.com)
Date: Wed Sep 29 2004 - 15:49:54 EDT

  • Next message: Denise Howard: "Eclipse not showing build.xml"

    I don't have a build.xml file right now--I'm using Eclipse's File->Export to
    create the application jar file. Are you saying I need to have build.xml?
    If so, how do I coordinate it with Eclipse's jar file creation? Or would I
    need to use the build.xml instead?

    Denise

    On 9/29/04 11:43 AM, "Ulrich Köster" <ulrich@objectstyle.org> wrote:

    > Moin Denise,
    >
    > you have to modify the build.xml of the app for that.
    >
    > The build.xml contains a lib part.
    >
    >
    > <lib dir=".">
    > <include name="Add .jar's that should be copied in the woa."/>
    > <exclude name="**/*.woa/**"/>
    > </lib>
    >
    > To include all jars from the folder "foo" in the apps project change it
    > to:
    >
    >
    > <lib dir=".">
    > <"foo/*.jar>
    > <exclude name="**/*.woa/**"/>
    > </lib>
    >
    > Ulrich
    >
    > Am 29.09.2004 um 06:23 schrieb Denise Howard:
    >
    >> I take back what I said earlier, now that I've learned how to get this
    >> information out of the jar: The MANIFEST.MF file does contain a
    >> Main-Class
    >> entry, and it is my Quickstart class.
    >>
    >> My CLASSPATH environment variable now includes all the Apache Axis
    >> jars, but
    >> running from the command line still yields the NoClassDefFoundError.
    >> What
    >> else can I try?
    >>
    >> Denise
    >>
    >>
    >> On 9/28/04 11:29 AM, "JR Ruggentaler" <JR.Ruggentaler@mpv.com> wrote:
    >>
    >>> Does Manifest.mf in Quickstart.jar contain a Main-Class: entry. What
    >>> is it?
    >>> The Main-Class: should contain a class name that implements the main
    >>> method
    >>> (public static void main(String[] args)...). Or you will need to add
    >>> Quickstart.jar to your classpath and specify the name of your "main"
    >>> class.
    >>>
    >>> J.R.
    >>> -----Original Message-----
    >>> From: Denise Howard [mailto:dhoward@pgp.com]
    >>> Sent: Tuesday, September 28, 2004 1:10 PM
    >>> To: JR Ruggentaler; Jason Dwyer; woproject-dev@objectstyle.org
    >>> Subject: Re: Beginner Eclipse problem
    >>>
    >>>
    >>> OK thanks, that will help a bunch.
    >>>
    >>> Before I get to the point of delivering the application jar
    >>> elsewhere, I
    >>> still need to figure out why I can't make it happy from the command
    >>> line.
    >>> Here's my invocation:
    >>>
    >>> java -cp
    >>> /Library/WebObjects/Extensions/axis.jar:/Library/WebObjects/
    >>> Extensions/axis-
    >>> ant.jar:/Library/WebObjects/Extensions/avalon-framework-4.1.2.jar:/
    >>> Library/W
    >>> ebObjects/Extensions/logkit-1.0.1.jar:/Library/WebObjects/Extensions/
    >>> log4j-1
    >>> .2.8.jar:/Library/WebObjects/Extensions/commons-logging.jar:/Library/
    >>> WebObje
    >>> cts/Extensions/jaxrpc.jar:/Library/WebObjects/Extensions/commons-
    >>> discovery.j
    >>> ar:/Library/WebObjects/Extensions/saaj.jar:/Library/WebObjects/
    >>> Extensions/ws
    >>> dl4j.jar -jar Quickstart.jar
    >>>
    >>> And here's the resulting error:
    >>>
    >>> Exception in thread "main" java.lang.NoClassDefFoundError:
    >>> org/apache/axis/AxisFault
    >>>
    >>> AxisFault is defined in axis.jar, which is certainly included in the
    >>> classpath. So why isn't it being found?
    >>>
    >>> Denise
    >>>
    >>> On 9/28/04 10:58 AM, "JR Ruggentaler" <JR.Ruggentaler@mpv.com> wrote:
    >>>
    >>>> Like most native and Java applications your application requires some
    >>>> supporting libraries (jars), you may want to package your dependant
    >>>> libraries
    >>>> and your application in a directory. Some developers use a common
    >>>> convention
    >>>> like having a libs directory in a path relative to the location of
    >>>> their
    >>>> application. They then distribute the application and it's supporting
    >>>> libraries as a zip or tar or some format that works best on the
    >>>> target
    >>>> platform. With this type of a setup the relative paths I described
    >>>> earlier
    >>>> would work given your requirements. Apple/NextStep application use
    >>>> similar
    >>>> strategies by having EO models, resources and other directories
    >>>> within the
    >>>> applications directory. I believe the old NextStep Installer used
    >>>> tar zipped
    >>>> files called packages to distribute apps.
    >>>>
    >>>> To simplify put your app and any supporting files/libraries in a
    >>>> directory
    >>>> and
    >>>> zip up all the file in the directory. Your app Manifest.mf file
    >>>> should point
    >>>> to the relative location of you Axis runtime libraries and any other
    >>>> libraries
    >>>> it requires. The user would unzip the files and should be able to
    >>>> launch you
    >>>> app by clicking on it. BTW: this is how Eclipse is distributed on MS
    >>>> Windows,
    >>>> don't know if it's the same on OS X.
    >>>>
    >>>> J.R.
    >>>>
    >>>> -----Original Message-----
    >>>> From: Denise Howard [mailto:dhoward@pgp.com]
    >>>> Sent: Tuesday, September 28, 2004 12:31 PM
    >>>> To: JR Ruggentaler; Jason Dwyer; woproject-dev@objectstyle.org
    >>>> Subject: 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 : Wed Sep 29 2004 - 15:50:15 EDT