Results 1 to 9 of 9
  1. #1
    srwpchelp is offline Member
    Join Date
    Dec 2010
    Posts
    5
    Rep Power
    0

    Default Error message "could not find the main class"

    Hi,

    I'm having difficult in running a JAR file in Windows 7.
    It worked fine in Windows XP.

    I keep on getting the error message :-
    "could not find the main class c:\xxxxxx\yyyy.jar".

    I've associated my jar file with Java platform SE binary.
    I've got JRE6.

    I've tried to search the internet & this site for solutions but I either don't understand them or they don't appear to work.

    Please can someone point for in the right direction.

    Thanks,
    Steve.

  2. #2
    Join Date
    Dec 2010
    Posts
    22
    Rep Power
    0

    Default

    When do you get this error? I mean the exact step

  3. #3
    srwpchelp is offline Member
    Join Date
    Dec 2010
    Posts
    5
    Rep Power
    0

    Default

    Hi,

    I get the error message when double-clicking the jar file in Windows Explorer. A black window appears very briefly but I've managed to do a screenshot.

    It says :-

    "Caused by. java.lang.class notfoundexception: c:\program files\jsymphonic\JSymphonic_v0.3.0.jar"

    AND

    There are quite a few "Unknown sources" messages.

    AND

    "Could not find the main class: c:\program files\jsymphonic\JSymphonic_v0.3.0.jar"

    Thanks,
    Steve.

  4. #4
    srwpchelp is offline Member
    Join Date
    Dec 2010
    Posts
    5
    Rep Power
    0

    Default

    Hi,

    I still haven't managed to find a solution to this problem.
    Please can anyone help?

    Thanks,
    Steve.

  5. #5
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    449
    Rep Power
    6

    Default

    As per my knowlege, It s because of class path problems.
    Mak
    (Living @ Virtual World)

  6. #6
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,538
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by srwpchelp View Post
    Hi,

    I still haven't managed to find a solution to this problem.
    Please can anyone help?
    Open that .jar file with winzip (or similar) and try to locate a file named manifest.mf. Copy it here; you have a classpath problem.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  7. #7
    srwpchelp is offline Member
    Join Date
    Dec 2010
    Posts
    5
    Rep Power
    0

    Default

    Hi,

    Thanks for the replies.
    The contents of the Manifest.mf file is :-

    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.7.1
    Created-By: 14.0-b16 (Sun Microsystems Inc.)
    Main-Class: org.danizmax.jsymphonic.gui.JSymphonic
    Class-Path: ../lib/swing-layout-1.0.3.jar

    Does this mean that I'm missing a file called "swing-layout-1.0.3.jar".

    Thanks,
    Steve.

  8. #8
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,538
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by srwpchelp View Post
    Hi,

    Thanks for the replies.
    The contents of the Manifest.mf file is :-

    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.7.1
    Created-By: 14.0-b16 (Sun Microsystems Inc.)
    Main-Class: org.danizmax.jsymphonic.gui.JSymphonic
    Class-Path: ../lib/swing-layout-1.0.3.jar

    Does this mean that I'm missing a file called "swing-layout-1.0.3.jar".
    I don't think so because (as per your reply #4) it was complaining about:

    Java Code:
    Caused by. java.lang.class notfoundexception: c:\program files\jsymphonic\JSymphonic_v0.3.0.jar"
    I suspect that the file association is incorrect; i.e. the jvm is trying to run your .jar file as if it were a single class. Try to find that association and add the "-jar" flag to it (just before the file name).

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  9. #9
    srwpchelp is offline Member
    Join Date
    Dec 2010
    Posts
    5
    Rep Power
    0

    Default

    I've gone into Set Associations in Windows 7 and have associated jar files with javaw.exe.

    Not sure how to do the -jar bit.
    From the command line? What do I need to type in?

    Thanks.

Similar Threads

  1. "Could not find the main class"
    By CCarr518 in forum New To Java
    Replies: 9
    Last Post: 09-25-2010, 06:11 PM
  2. Replies: 3
    Last Post: 08-25-2010, 10:21 AM
  3. Replies: 5
    Last Post: 06-22-2010, 03:51 PM
  4. Replies: 6
    Last Post: 05-18-2010, 05:11 PM
  5. Replies: 1
    Last Post: 06-30-2009, 02:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •