I am a very inexperienced programmer. I have just taken a weeklong class on Java programming in Eclipse. When I got home and installed Eclipse on my home computer, I was able to bring up the program I made in the editor but Eclipse would not run it; it only accepted .ant files.
I was able to get projects to show up in the Project Explorer (by importing them) and change the classpath to recognize those projects, but nothing shows up as an option to select a main class in run>run configurations>Java application. I am very confused as I have not been taught to use these features of Eclipse in the one week of Java experience I have. Any help would be very much appreciated.
Update: When I try to configure the build path/classpath, I still have no options for selecting a main class in run>run configurations>Java application, even after following Logan's advice. The JRE system library is still on the build path, but there's a red X on its icon in my project's properties.Plus, this is also at the top of my project's Properties window:
"Build path entry is missing: org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7
To make matters worse, when I click the Run button, the options for the type of file to run the script depend on what I have selected. If I've selected the project in the Project Explorer, the options are Java Applet and Java Application, but if I've selected the code in the display, the .ant file options come up.
Plus, there is no # in front of the name of the source folder.
One more important piece of info: The Eclipse SDK folder never downloaded, for some reason. However, I extracted all the .zip files in the Juno folder and the Eclipse application did appear.
Help would be appreciated, especially as literal, straightforward directions on what to do. Thank you.
I think I have run into this before. You need to add the JRE System Library to your project build path libraries.
Your project in the Package Explorer should show the JRE System Library after your source folder if you have one.
Also check that your source code folder is on the build path of the project. Your source folder should have the # in front of the name like #src if that folder is on the build path. If it does not have the # sign, you may need to right click on that folder with your code and add it to the build path.
I solved it by going to Eclipse ->preferences-->java-->installed jre --> select a standard Vm in my case (Mac OSX) /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home.Finish
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With