Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Eclipse will only run first program HelloWorld(Cannot seem to open or run any other file or project)
icon5.gif  Eclipse will only run first program HelloWorld [message #1692290] Tue, 14 April 2015 20:41 Go to next message
Joe Rothengast is currently offline Joe RothengastFriend
Messages: 1
Registered: April 2015
Junior Member
Ladies and Gents,

I seem to be having a rather strange problem. I just downloaded and installed the latest version of Eclipse Luna and worked through the HelloWorld tutorial in Eclipse saving it as a project as requested. I then created a 2nd project and saved that, as well. Eclipse will only run that first HelloWorld program. I did some searching on Google and only found one relevant similar problem (see link below), but closing the HelloWorld project did not seem to solve the problem. I tried quitting and relaunching Eclipse and the problem persists.

I cannot select the other program by using on the arrow next to the green circle run button. It's as if the file and project do not exist even though the code is open and obviously there. At this point if I go to the top level menu and click on Project, open and close project is grayed out, so I cannot even reopen these projects. I tried the Clean choice under Project and also no help.

2) Am I missing something obvious or is this version not especially compatible with my aging Mac? Is there an older, more stable version of this tool? I read great things about Eclipse and it seems to have some nice features. I have used many an IDE. I am stumped.

3) Incidentally, where is the compile button?

I would appreciate any insight or suggestions. Thank you in advance, Joe

stackoverflow.com/questions/2167449/eclipse-always-runs-all-projects-how-can-i-only-run-one

My enviroment is a MacBook Air from 2011 still running Lion OS X 10.7.5 1.8 GHz Intel Core i7 and 4 GB RAM

Eclipse Java EE IDE for Web Developers.

Version: Luna Service Release 2 (4.4.2)
Build id: 20150219-0600
Re: Eclipse will only run first program HelloWorld [message #1692306 is a reply to message #1692290] Tue, 14 April 2015 23:32 Go to previous message
David Wegener is currently offline David WegenerFriend
Messages: 1445
Registered: July 2009
Senior Member
In order to run an application, Eclipse creates a Launch Configuration
that specifies things like the class to run, the classpath to run
against, the working directory to run in, etc.

Eclipse will remember the last application that you ran and will run
that as the default when you click the Run icon. This may be what you
are experiencing. In order to run your second application you need to
get a Launch Config created for it.

There are a couple of ways to do this. First, make sure that the
program you are trying to run is a valid Java application. The class
you want to run has to have a public static void main(String[] args) method.

If you have the class open in the Eclipse Java Editor, you can right
click in the editor window and select Run As->Java Application. This
will create a Launch Config using the class as the main class and
default the other items. It will then run the application.

You can do something similar from the Package Explorer view. Select
your main class, right click and again select Run As->Java Application.

A third way to create the Launch Config is to open the Run
Configurations dialog. From the menu select Run->Run Configurations...
Look for Java Application in the list on the left and follow the
directions.

Eclipse will keep track of the most recent programs you have run. If
you don't want to re-run the last one, you can click the down icon next
to the Run icon and get a list of previous programs to chose from.


Note that these options will only work if the program you wish to run is
in a Java Project. You select the type of project when you initially
create it from the New->Project menu. To check and see if you have a
Java project, right click on the project in Package Explorer and select
Properties. Java projects will have entries for Java Build Path, Java
Compiler, etc. If you don't see these in the properties dialog, you
need to create a Java project.

The Java Development Users Guide included in the Help has a Basic
Tutorial that goes over this in more detail. Look for the Running your
programs section.


Finally, there is no Compile button. Eclipse has an incremental
compiler that is used to keep all of your code up to date each time you
save a file. The default setting has the incremental compiler turned
on. If you want to control builds, you have to turn off Project->Build
Automatically from the menu. With Build Automatically turned off, the
Project->Build All and Project->Build Project items are enabled and you
have to select them to perform builds.
Previous Topic:47GB Log on jetty-9.2.9.v20150224 !!!
Next Topic:org.osgi.framework.BundleException: Error starting module.
Goto Forum:
  


Current Time: Fri Sep 20 01:56:14 GMT 2024

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

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

Back to the top