Frequently Asked Questions (FAQs)

Here are questions we have seen frequently about Eclipse. If you have other Eclipse problems that are not listed here, please email the instructor for help. Please provide as much detail as you can in your message (your computer type and OS, your JDK version, your Eclipse version, what steps you have tried, exactly what is failing, what error messages you are seeing, etc.).

Q: I am getting lots of weird errors when I try to run Eclipse.
A: Make sure to extract the Eclipse files out of the .zip archive before you try to run it. Also make sure your JDK is up-to-date and is version 1.6 or higher.
Q: How do I compile a file in Eclipse? I opened my program file but can't find any Compile option that works.
A: In Eclipse, you shouldn't open individual files. You should instead create a project and put your files inside it. Click File, New, Project..., then choose a Java Project. See the "setting up a project" page from the links at left.
Q: I am seeing an error message about an "Ant build error" when I try to compile my program.
A: See previous question. You should not try to open and compile individual files; make a project instead.
Q: How do I compile (or re-compile) my project?
A: Eclipse continually re-compiles your code every time you change it. You don't need to explicitly press any Compile button to do this.
Q: How do I add a file to an existing Eclipse project?
A: Save the file into the project's folder, then go to Eclipse and right-click the icon for your project in the Package Explorer at left, and choose Refresh. You should now see your file in the project.
Q: How do I run my project?
A: Right-click the "Main" class in the Package Explorer at left, then choose Run As, Java Application.
Q: When I try to run my project by clicking the green "Play" button, I get an error of, "The Selection cannot be launched, and there are no recent launches."
A: See previous question. You must run your project's "Main" class at least once by using the right-click method described above, before the "Play button" to run a project will work.
Q: When I try to compile or run my project, I see this error:
Usage: javaw [-options] class [args...]
A: You may not have the JDK installed properly. This error usually means that you have only the JRE, not the JDK, installed. JRE is a Java runner but does not include a compiler. Go to Sun's Java site and re-download and install the JDK.
Q: When I try to run Eclipse, I see an error like this:
Error: Could not open 'C:\Users\...\Desktop\lib\i386\jvm.cfg'
A: This happens when you have multiple versions of the Java installed and Windows is using the wrong one. This can be fixed, but it's a bit tricky. You must add Java to your computer's PATH, which is a global system variable containing a list of folders in which to look for programs. Go to Control Panel, then System, then Advanced, then click the Environment Variables button. In the window that pops up, go to the section containing the System Variables, and scroll down until you find the one named PATH. Edit this variable's value, which should be a series of semicolon-separated directories, and add your Java JDK's "bin" subdirectory to the start of it. For example, if you installed JDK into C:\Program Files\Java\jdk1.6.0_23, and if your current PATH value had said:
C:\foo\bar;C:\WINDOWS\SYSTEM32;C:\a\b\c
Then you would insert the following at the front of the value:
C:\Program Files\Java\jdk1.6.0_23\bin;C:\foo\bar;C:\WINDOWS\SYSTEM32;C:\a\b\c
Then click OK to close all the various dialog boxes. Now retry running Eclipse!
Q: I accidentally closed an important tab or window in Eclipse (the Package Explorer, etc.). How do I get it back?
A: From the top menus, click Window, Show View. All the various sub-panes and tabs and windows are there. Select the one you want to see, and it should come back.