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. Advertisements

  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. Advertisements

  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. Advertisements

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. James Alan Farrell
    Replies:
    6
    Views:
    10,023
    Andrew Thompson
    Jan 9, 2004
  2. hiwa
    Replies:
    1
    Views:
    1,708
    James Alan Farrell
    Jan 13, 2004
  3. cyril
    Replies:
    2
    Views:
    4,428
    cyril
    Aug 25, 2004
  4. Tarlika Elisabeth Schmitz

    [WebStart] "Could not find main-class"

    Tarlika Elisabeth Schmitz, Nov 3, 2004, in forum: Java
    Replies:
    13
    Views:
    6,555
    Tarlika Elisabeth Schmitz
    Nov 4, 2004
  5. Replies:
    4
    Views:
    1,317
    kaeli
    May 24, 2005
  6. E11
    Replies:
    1
    Views:
    5,759
    Thomas Weidenfeller
    Oct 12, 2005
  7. learner9
    Replies:
    0
    Views:
    1,323
    learner9
    Apr 14, 2006
  8. Brandon McCombs
    Replies:
    6
    Views:
    1,171
    Brandon McCombs
    Dec 30, 2006
Loading...