Cannot find main class

Discussion in 'Java' started by Ike, Jan 30, 2007.

  1. Ike

    Ike Guest

    I have a client who has two jar files, Hydroline.jar and LiquidLnF.jar, in a
    directory on WinXP machine. when he goes to that directory, and enters at a
    DOS prompt:

    javaw -cp Hydroline.jar;LiquidLnF.jar HydroLine.HydroLine

    He gets a dialog box that says "Java Virtual Machine Loader.....Could not
    find the main class. Program will exit."

    The main class is HydroLine.HydroLine, as specified in the HydroLine.jar's
    manifest file. Additionally, the class HydroLine.HydroLine is in that jar
    file.

    When I go to run this on my machine, it works fine. Anyone have any ideas
    what might be the problem here? Thanks. -Ike
     
    Ike, Jan 30, 2007
    #1
    1. Advertising

  2. On Jan 30, 11:12 am, "Ike" <> wrote:
    > I have a client who has two jar files, Hydroline.jar and LiquidLnF.jar, in a
    > directory on WinXP machine. when he goes to that directory, and enters at a
    > DOS prompt:
    >
    > javaw -cp Hydroline.jar;LiquidLnF.jar HydroLine.HydroLine
    >
    > He gets a dialog box that says "Java Virtual Machine Loader.....Could not
    > find the main class. Program will exit."
    >
    > The main class is HydroLine.HydroLine, as specified in the HydroLine.jar's
    > manifest file. Additionally, the class HydroLine.HydroLine is in that jar
    > file.
    >
    > When I go to run this on my machine, it works fine. Anyone have any ideas
    > what might be the problem here? Thanks. -Ike


    Can you try:

    java -jar HydroLine.jar ?

    -cheers,
    Manish
     
    Manish Pandit, Jan 30, 2007
    #2
    1. Advertising

  3. Ike

    Oliver Wong Guest

    "Ike" <> wrote in message
    news:5MMvh.18761$...
    >I have a client who has two jar files, Hydroline.jar and LiquidLnF.jar, in
    >a directory on WinXP machine. when he goes to that directory, and enters
    >at a DOS prompt:
    >
    > javaw -cp Hydroline.jar;LiquidLnF.jar HydroLine.HydroLine
    >
    > He gets a dialog box that says "Java Virtual Machine Loader.....Could not
    > find the main class. Program will exit."
    >
    > The main class is HydroLine.HydroLine, as specified in the HydroLine.jar's
    > manifest file. Additionally, the class HydroLine.HydroLine is in that jar
    > file.
    >
    > When I go to run this on my machine, it works fine. Anyone have any ideas
    > what might be the problem here? Thanks. -Ike


    I think the recommended way of running an application in a jar is to use
    the "-jar" flag, as in "java -jar Hydroline.jar". The Hydronline.jar's
    manifest file would specify the main class, and any other jar it depends on
    (i.e. the LiquidLnF.jar). See
    http://java.sun.com/docs/books/tutorial/deployment/jar/run.html

    - Oliver
     
    Oliver Wong, Jan 30, 2007
    #3
  4. Ike wrote:
    > I have a client who has two jar files, Hydroline.jar and LiquidLnF.jar, in a
    > directory on WinXP machine. when he goes to that directory, and enters at a
    > DOS prompt:
    >
    > javaw -cp Hydroline.jar;LiquidLnF.jar HydroLine.HydroLine
    >
    > He gets a dialog box that says "Java Virtual Machine Loader.....Could not
    > find the main class. Program will exit."
    >
    > The main class is HydroLine.HydroLine, as specified in the HydroLine.jar's
    > manifest file. Additionally, the class HydroLine.HydroLine is in that jar
    > file.
    >
    > When I go to run this on my machine, it works fine. Anyone have any ideas
    > what might be the problem here? Thanks. -Ike
    >
    >


    -cp and -jar are mutually exclusive and -jar has priority. You cannot
    specify a classpath with the -cp option if you specify the -jar option.
    All classpath arguments must be in the manifest file for jarred
    applications.

    --

    Knute Johnson
    email s/nospam/knute/
     
    Knute Johnson, Jan 31, 2007
    #4
    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. John M
    Replies:
    1
    Views:
    1,212
    Kumar Reddi
    May 29, 2005
  2. James Alan Farrell
    Replies:
    6
    Views:
    9,709
    Andrew Thompson
    Jan 9, 2004
  3. hiwa
    Replies:
    1
    Views:
    1,575
    James Alan Farrell
    Jan 13, 2004
  4. cyril
    Replies:
    2
    Views:
    3,878
    cyril
    Aug 25, 2004
  5. Replies:
    4
    Views:
    1,022
    kaeli
    May 24, 2005
Loading...

Share This Page