1

how do you compile in Eclipse? And how do you run the program using this given with the choices: Java Applet or Java Application?

Krish
  • 21
  • 1
  • [This post](http://stackoverflow.com/questions/1385134/eclipse-guide-for-beginners) contains some good resources for Eclipse newcomer, you might need it :) – Rangi Lin Jun 24 '11 at 11:09
  • See http://www.vogella.de/articles/Eclipse/article.html#firstjava_run – Robert Jun 24 '11 at 11:10

2 Answers2

1

If Project -> Build Automatically is enabled, you will compile when saving your work.

To run it, you have an arrow in a green circle in your toolbar (6th tool if you have a default benchmark). It will run the project using the currently showing class as a main class if it has a main method, or the last run main if it doesn't. Alternatively, you can use the keyboard shortcut CTRL+F11.

If you click on the little down arrow next to the green button, you can access to a history of classes you ran and to the Run configuration, which allows you for example to run a program with parameters or, what interrests you here, to choose to run it as an applet or an application.

SteeveDroz
  • 6,006
  • 6
  • 33
  • 65
0

Turn on the option: Project > Build Automatically

If you have a main method, run as Java Application. To create a main, type main then ctrl+space and select "main method" to have eclipse auto create it for you.

Bohemian
  • 412,405
  • 93
  • 575
  • 722