views:

176

answers:

4

After checking out code for the first time from a repository into Eclipse using the Subclipse plugin, I've found that I am not able to run Java applications anymore. Usually when I right click in the text editor window and select "Run As", I see the option to "Run as Java Application". Now, however, all I see is "Run on server." Is there another way to run it as a Java application or is there some option that I need to re-configure?

+1  A: 

Does the class you're trying to run have a public static void main(String[] args) method signature?

Peter
A: 

You can go to Run As->Run configurations to set where your main class is located, as this was likely changed or not set.

AlbertoPL
A: 

I have seen this if the Eclipse project is not a Java project.

Does it have Java nature?

If not, delete it, and use Check out as.. to ensure it is setup correctly. This behaviour depends on the existance of the .project and .classpath files in the source repository.

Thorbjørn Ravn Andersen
+1  A: 

I actually figured it out - I checked out the wrong directory. Because the src directory was a sub-directory, it wasn't being recognized as a package and thus wasn't allowing the .java files to be run as Java apps. Once I checked out the right directory, it worked.

Brian Lewis