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 3 of 3

Thread: Java Beginner - Error on compilation "Could not find or load main class" while using Eclipse

  1. #1
    Junior Member
    Join Date
    Jan 2025
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Java Beginner - Error on compilation "Could not find or load main class" while using Eclipse

    I have written a simple Java program using Eclipse and Java 23. On compilation it gives error "Could not find or load main class". Also, on loading the project I see error such as "The project was not built due to release 23 is not found in the system". I can make out it is something to do with environment variables or classpath. But what exactly needs to be done to resolve both these errors ?

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,169
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Java Beginner - Error on compilation "Could not find or load main class" while using Eclipse

    Sorry, I do not use eclpse. Maybe someone on this forum could help: https://coderanch.com/f/180/eclipse
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Jan 2025
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java Beginner - Error on compilation "Could not find or load main class" while using Eclipse

    Resolved - While creating the Maven project using Spring Initializr, I had earlier given Java 23 as the option. This time I gave Java 21 as the option and created the project. Opened this project in Eclipse and compiled it. Both the errors vanished. Not sure why it worked because Java version installed in my machine is 23. Anyway, I am now able to compile and run my Java application.

Similar Threads

  1. Replies: 1
    Last Post: June 14th, 2020, 06:54 AM
  2. Replies: 6
    Last Post: August 16th, 2014, 01:34 AM
  3. Replies: 7
    Last Post: January 19th, 2014, 05:18 PM
  4. Replies: 4
    Last Post: September 3rd, 2012, 02:47 AM