Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Eclipse Could not find or load main class(code works on command line but not in Eclipse)
Eclipse Could not find or load main class [message #1786819] Sun, 13 May 2018 07:32 Go to next message
Wayne George is currently offline Wayne GeorgeFriend
Messages: 2
Registered: May 2018
Junior Member
Hi,

I have installed Eclipse oxygen on my windows 10 laptop. Here are some config info:

Eclipse Version:
Eclipse Java EE IDE for Web Developers.
Version: Oxygen.3a Release (4.7.3a) Build id: 20180405-1200

Java version:
java version "1.8.0_172"
Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode)

Windows version: 10 pro

Test code:

public class Test {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("Test");
}
}

I created a java project within Eclipse. Eclipse compiled the code and generated a Test.class file under the bin directory. But "Run as application" doesn't work. The error message is : "Error: Could not find or load main class Test".

Under the bin directory, "java Test" works fine in the command line.

I tried to modify the classpath configurations in Eclipse but with no success.

Is there any place I have missed about Eclipse configuration? Or it is a Eclipse installation issue with Windows?

Thank you in advance for your help.

Wayne




Re: Eclipse Could not find or load main class [message #1786833 is a reply to message #1786819] Sun, 13 May 2018 19:58 Go to previous message
Wayne George is currently offline Wayne GeorgeFriend
Messages: 2
Registered: May 2018
Junior Member
It turned out the Eclipse workspace is under the directory with non ascii characters. Even though within the workspace everything (creating the project, compiling, etc) seemed fine, javaw.exe couldn't reach the bin directory.
So once I moved the workspace outside of the directory, everything works now.
Previous Topic:Need help
Next Topic:Tutorial #2 Create Hello World SWT application
Goto Forum:
  


Current Time: Fri May 25 20:59:32 GMT 2018

Powered by FUDForum. Page generated in 0.02448 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top