Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Executable jar file

Reply
Thread Tools

Executable jar file

 
 
sc_wizard29@hotmail.com
Guest
Posts: n/a
 
      02-20-2007
Hi everyone,

I have an executable jar file that lies in c:\lib (yes, I'm on a
windows box)... and I want to execute it from c:\

This jar file contains the following MANIFEST.MF file :

Manifest-Version: 1.0
Created-By: 1.4.2_08 (Sun Microsystems Inc.)
Main-Class: sub1.HelloWorld1

I've tried 3 different ways to execute the jar file :

C:\>java -classpath ".\lib\sub1_exec.jar" sub1.HelloWorld1
HelloWorld1.main() : hello world
C:\jar>java -jar .\lib\sub1_exec.jar
HelloWorld1.main() : hello world
C:\jar>java -classpath ".\lib\sub1_exec.jar" -jar sub1_exec.jar
Unable to access jarfile sub1_exec.jar

Can anyone explain me why the last method doesn't work ? (and what can
I do if I don't want to make it work ?)

Thanks for helping... this stuff is driving me crazy

 
Reply With Quote
 
 
 
 
Thomas Kellerer
Guest
Posts: n/a
 
      02-20-2007
On 20.02.2007 17:36 wrote:
> I've tried 3 different ways to execute the jar file :
>
> C:\>java -classpath ".\lib\sub1_exec.jar" sub1.HelloWorld1
> HelloWorld1.main() : hello world
> C:\jar>java -jar .\lib\sub1_exec.jar
> HelloWorld1.main() : hello world
> C:\jar>java -classpath ".\lib\sub1_exec.jar" -jar sub1_exec.jar
> Unable to access jarfile sub1_exec.jar
>
> Can anyone explain me why the last method doesn't work ?


Because the -classpath parameter is ignored when you specify -jar

See the description of the -jar parameter at
http://java.sun.com/javase/6/docs/te...dows/java.html

Thomas
 
Reply With Quote
 
 
 
 
sc_wizard29@hotmail.com
Guest
Posts: n/a
 
      02-20-2007
> See the description of the -jar parameter at
> http://java.sun.com/javase/6/docs/te...dows/java.html


"When you use this option, the JAR file is the source of all user
classes, and other user class path settings are ignored"

That was a fast answer... thank you very much !!!

 
Reply With Quote
 
hthukral.mickey@gmail.com
Guest
Posts: n/a
 
      02-20-2007
On Feb 20, 9:46 pm, "sc_wizar...@hotmail.com"
<sc_wizar...@hotmail.com> wrote:
> > See the description of the -jar parameter at
> >http://java.sun.com/javase/6/docs/te...dows/java.html

>
> "When you use this option, the JAR file is the source of all user
> classes, and other user class path settings are ignored"
>
> That was a fast answer... thank you very much !!!


hi

i wnat to some guidance regarding ..from where and how can i learn
programming in java ...any particular Books /refernces ....i'd tried
many so faar..
but not satisfied .

 
Reply With Quote
 
Andrew Thompson
Guest
Posts: n/a
 
      02-20-2007
On Feb 21, 8:19 am, hthukral.mic...@gmail.com wrote:
...
> i wnat to some guidance regarding ..from where and how can i learn
> programming in java ...any particular Books /refernces ....i'd tried
> many so faar..


Why did you put your question on the end
of this thread that has nothing to do
with books?

It makes more sense to start a new thread
under the subject 'Book recommendations'.

Andrew T.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Running an Executable Before Executable JAR Jason Cavett Java 8 05-16-2007 07:14 PM
java -cp a.jar -jar b.jar => Works on Windows, not on Debian cyberco Java 4 02-14-2006 06:27 AM
jaas.jar, jta.jar jdbc-stdext.jar missing from jdk1.5 RPM muttley Java 0 10-20-2005 02:40 PM
Differences of xercesImpl.jar, xercesImpl-J.jar, dom3-xercesImpl.jar ? Arnold Peters Java 0 01-05-2005 10:59 PM
Differences of xercesImpl.jar, xercesImpl-J.jar, dom3-xercesImpl.jar ? Arnold Peters XML 0 01-05-2005 10:59 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57