Executable jar file

Discussion in 'Java' started by sc_wizard29@hotmail.com, Feb 20, 2007.

  1. Guest

    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 ;-)
    , Feb 20, 2007
    #1
    1. Advertising

  2. 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/technotes/tools/windows/java.html

    Thomas
    Thomas Kellerer, Feb 20, 2007
    #2
    1. Advertising

  3. Guest

    , Feb 20, 2007
    #3
  4. Guest

    On Feb 20, 9:46 pm, ""
    <> wrote:
    > > 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 !!!


    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 .
    , Feb 20, 2007
    #4
  5. On Feb 21, 8:19 am, 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.
    Andrew Thompson, Feb 20, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Arnold Peters
    Replies:
    0
    Views:
    553
    Arnold Peters
    Jan 5, 2005
  2. muttley
    Replies:
    0
    Views:
    2,688
    muttley
    Oct 20, 2005
  3. cyberco
    Replies:
    4
    Views:
    3,722
    Roedy Green
    Feb 14, 2006
  4. Arnold Peters
    Replies:
    0
    Views:
    637
    Arnold Peters
    Jan 5, 2005
  5. Jason Cavett
    Replies:
    8
    Views:
    606
    Sanjay
    May 16, 2007
Loading...

Share This Page