Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: "Could not find the main class: main. program will exit" - Wierd case.

  1. #1
    Junior Member
    Join Date
    Dec 2013
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default "Could not find the main class: main. program will exit" - Wierd case.

    I finished a game in Java. I used Eclipse to program it.
    I wrapped the game in an EXE file, using Launch4j.

    The game runs perfectly fine on my computer, both by double-clicking the EXE, and by double clicking the JAR (and also by doing the same two things from the command line).

    I sent the EXE file to a friend, packed in a RAR. (We both use Windows).

    He tried to launch it from inside the RAR, and got this error:

    "Could not find the main class: Main. program will exit"

    Same error when extracting the EXE to the desktop and launching from there.

    I checked in my MANIFEST file inside the JAR. It seems fine:

    Manifest-Version: 1.0
    Class-Path: .
    Main-Class: Main

    His Java version is 1.6.0.29 . Not so old, is it?

    He offered to update Java on his computer to 1.7. He did and now it works.

    Why would this error would appear when the version is older than 1.7?
    I think that 1.6 isn't that old, is it? And if it is, still - why this particular error?

    Could this be something wrong with my coding? Or something else?

    Thanks a lot


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,422
    Thanks
    49
    Thanked 2,215 Times in 2,188 Posts

    Default Re: "Could not find the main class: main. program will exit" - Wierd case.

    Java 1.6 is not able to execute classes created with java 1.7
    The error message would be: Unsupported major.minor version 51.0
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Replies: 7
    Last Post: January 19th, 2014, 04:18 PM
  2. Exception in thread "main" java.lang.NoSuchMethodError: main?
    By Sakharam01 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: June 10th, 2013, 08:06 AM
  3. Replies: 4
    Last Post: September 3rd, 2012, 02:47 AM
  4. Replies: 1
    Last Post: August 12th, 2012, 11:21 AM
  5. Replies: 6
    Last Post: November 12th, 2010, 03:40 AM

Tags for this Thread