Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2007

Tip: Looking for answers? Try searching our database.

Executable jar file

Thread view: 
sc_wizard29@hotmail.com - 20 Feb 2007 16:36 GMT
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 ;-)
Thomas Kellerer - 20 Feb 2007 16:42 GMT
> I've tried 3 different ways to execute the jar file :
>
[quoted text clipped - 6 lines]
>
> 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/technotes/tools/windows/java.html

Thomas
sc_wizard29@hotmail.com - 20 Feb 2007 16:46 GMT
> See the description of the -jar parameter at
> http://java.sun.com/javase/6/docs/technotes/tools/windows/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 !!!
hthukral.mickey@gmail.com - 20 Feb 2007 21:19 GMT
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/technotes/tools/windows/java.html
[quoted text clipped - 3 lines]
>
> 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 .
Andrew Thompson - 20 Feb 2007 21:29 GMT
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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.