Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Confusion with making new projects/java files
Confusion with making new projects/java files [message #878917] Wed, 30 May 2012 07:44 Go to next message
Ed Z is currently offline Ed ZFriend
Messages: 1
Registered: May 2012
Junior Member
Hi I just started using Eclipse, and I'm still a bit unfamiliar with some very basic stuff. One question I have is regarding creating files. The first thing I wanted to do is create a simple hello world program

class HelloWorld{
public static void main(String[] args){
System.out.println("Hello World");
}
}

which works fine when I create a class file within a java project. However, when I create a general file and then name it helloworld.java, it says I have no main method. What is the distinction between the two, and why does it do that?

Another thing I'm having trouble with is importing preexisting java files. I have in a folder, several .java files and .png images for a project I did a while back. When I try to use the import, with a file system, I can see all the files in that folder in the package explorer. But when I try to run the file, it gives me the same main method error as above. This is really puzzling as I used to use JCreator, and I could compile and run that same file with no problems at all. What would be the correct way to import preexisting related java files in a folder?

Thanks for your help.
Re: Confusion with making new projects/java files [message #879110 is a reply to message #878917] Wed, 30 May 2012 14:32 Go to previous message
David Wegener is currently offline David WegenerFriend
Messages: 1445
Registered: July 2009
Senior Member
Make sure that the project is a Java project (when you create the project select Java project from the available project types.) Make sure that the java files are on in a source folder. The Properties dialog for a Java Project will have a Build Path section. On the Source tab will be a list of source folders.

You may want to go through the Java tutorial in the Help section. It explains project organization and setup.
Previous Topic:Where to start?
Next Topic:Package Options
Goto Forum:
  


Current Time: Thu Mar 28 19:05:37 GMT 2024

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

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

Back to the top