Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Java Program wont run properly.
Java Program wont run properly. [message #642835] Thu, 02 December 2010 16:09 Go to next message
No real name is currently offline No real name
Messages: 3
Registered: December 2010
Junior Member
When I try to run my Java program, it automatically goes to the "Run As" window. In the window, there are only two options - "Ant Build" and "Ant Build..." How do I successfully run it? I do not have any "Ant" program.

[Updated on: Thu, 02 December 2010 16:10]

Report message to a moderator

Re: Java Program wont run properly. [message #642841 is a reply to message #642835] Thu, 02 December 2010 17:00 Go to previous messageGo to next message
David Wegener is currently offline David Wegener
Messages: 1336
Registered: July 2009
Senior Member
Does the Java class that you are trying to run have a public static void main(String[]) method. If not, you can't run it.
Re: Java Program wont run properly. [message #643075 is a reply to message #642841] Fri, 03 December 2010 18:26 Go to previous messageGo to next message
No real name is currently offline No real name
Messages: 3
Registered: December 2010
Junior Member
Yes it does.
Here is the program:



public class tutorial_13_program_1 {
public static void main (String args[]) {
int counter = 0;

while (counter < 10) {
System.out.println (counter);
counter++;
}

}
}
Re: Java Program wont run properly. [message #643076 is a reply to message #643075] Fri, 03 December 2010 18:29 Go to previous message
No real name is currently offline No real name
Messages: 3
Registered: December 2010
Junior Member
I switched the workspace so now the same program works!
Thanks.
Previous Topic:classes compiled by Eclipse are different from classes using ANT build.xml file created by Eclipse.
Next Topic:problem Of Perm Gen Space
Goto Forum:
  


Current Time: Tue Jul 29 15:02:38 EDT 2014

Powered by FUDForum. Page generated in 0.02335 seconds