Article View: borland.public.jbuilder.java.language
Article #702Re: classpath issue
From: Lori M Olson [TeamB]
Date: Wed, 01 Dec 2004 22:52
Date: Wed, 01 Dec 2004 22:52
45 lines
2772 bytes
2772 bytes
Preston wrote:
> I have a jar that I've created using JBuilder. If I run the jar from within
> JBuilder it works fine. If I run it from the command line I get a
> classNotFoundException.
>
> I've tried creating and setting a CLASSPATH environment variable. I've even
> tried doing java -jar myjar.jar -classpath pathToDependantJar. Neither of
> these has worked.
You use -classpath OR -jar, not both.
http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/java.html
<quote>
-jar
Execute a program encapsulated in a JAR file. The first argument is
the name of a JAR file instead of a startup class name. In order for
this option to work, the manifest of the JAR file must contain a line of
the form Main-Class: classname. Here, classname identifies the class
having the public static void main(String[] args) method that serves as
your application's starting point. See the Jar tool reference page and
the Jar trail of the Java Tutorial for information about working with
Jar files and Jar-file manifests.
When you use this option, the JAR file is the source of all user
classes, and other user class path settings are ignored.
</quote>
--
Regards,
Lori Olson [TeamB]
------------
Save yourself, and everyone else, some time and search the
newsgroups and the FAQ-O-Matic before posting your next
question.
Google Advanced Newsgroup Search
http://www.google.ca/advanced_group_search
Other Newsgroup Searches:
http://www.borland.com/newsgroups/ngsearch.html
Joi Ellis's FAQ-O-Matic:
http://www.visi.com/~gyles19/fom-serve/cache/1.html
Technical Details
Message-ID:
<41ae4b34$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsgate.cistron.nl!feeder1.cambrium.nl!feed.tweaknews.nl!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<41ae47c9@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: f74b3,d2955265e6ebc78e X-Google-Attributes: gidf74b3,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Wed, 01 Dec 2004 15:52:37 -0700 From: "Lori M Olson [TeamB]" <javadragon@techie.com> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax; CDonDemand-Dom) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language Subject: Re: classpath issue References: <41ae47c9@newsgroups.borland.com> In-Reply-To: <41ae47c9@newsgroups.borland.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 142.179.181.200 Message-ID: <41ae4b34$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1101941556 142.179.181.200 (1 Dec 2004 14:52:36 -0700) Lines: 46 Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsgate.cistron.nl!feeder1.cambrium.nl!feed.tweaknews.nl!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail