Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Why won't this work?(Eclipse will not recognize explicitly written main type)
icon4.gif  Why won't this work? [message #1754969] Fri, 24 February 2017 17:31 Go to next message
Wesley Todd is currently offline Wesley ToddFriend
Messages: 1
Registered: February 2017
Junior Member
Mad

I was trying to write a "Hello World" program (I'm trying to learn Java), and Eclipse keeps saying that there's no main type, even though I explicitly wrote it in. Why is this happening?

Here's the code:

class Example {
public static void main(String args[]) {
System.out.println("This is a simple Java program.");
}
}
Re: Why won't this work? [message #1754992 is a reply to message #1754969] Sat, 25 February 2017 07:47 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 31244
Registered: July 2009
Senior Member
Probably the file isn't in a Java project's source folder so it's not on your classpath. Did you create a Java project? Does it have a src folder? Is your .java file in that folder?
Previous Topic:Error "java.lang.NullPointerException" in workspace while browsing
Next Topic:Add Tomcat8 to Eclise Neon on Linux Mint
Goto Forum:
  


Current Time: Fri Jul 10 08:39:33 GMT 2020

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

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

Back to the top