File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes IDEs, Version Control and other tools and the fly likes [Tutorial] How to Compile a Java program in Eclipse Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "[Tutorial] How to Compile a Java program in Eclipse" Watch "[Tutorial] How to Compile a Java program in Eclipse" New topic
Author

[Tutorial] How to Compile a Java program in Eclipse

Vishal Lad
Greenhorn

Joined: Feb 20, 2011
Posts: 4
Step 1:
When you start eclipse, it asks your for the address of the workspace. Workspace is a folder where eclipse will store all your project files.


Step 2:

To start a new project go to <strong>New->JAVA project</strong>.


Step 3:
Enter the details of your project i.e your project name.


Step 4:

Create a new class. To do this right click on your project name which is "MyProject" in this case and select <strong>New->Class</strong>.



Step 5:

Enter the name of your class. Click finish.



Step 6: Compiling

To compile, just press the RUN button or the DEBUG button to the left of the run button.



Source: http://www.mycoding.net/2011/02/compiling-a-java-program-in-eclipse/


My programs can be found at www.mycoding.net
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

To compile, just press the RUN button or the DEBUG button to the left of the run button.

Not completely true. You don't need to run or debug an application to compile it.


[My Blog]
All roads lead to JavaRanch
Sunil Tiwari
Ranch Hand

Joined: Sep 19, 2006
Posts: 49

Nice attempt to get people on board with Eclipse and Java!


~ Neil (SCJP)
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

In step 5, I would click the "public static void main(String[] args)" checkbox.
Greg Brannon
Bartender

Joined: Oct 24, 2010
Posts: 557
You've used "compiling" to be the same as "running," which isn't entirely correct. I don't know if Eclipse allows one to compile Java source code to class files without running the project. It seems not, but maybe I just haven't figured out how, and in spite of its title, this How To doesn't show me.


Learning Java using Eclipse on OpenSUSE 11.2
Linux user#: 501795
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5823
    
    7

Greg Brannon wrote:I don't know if Eclipse allows one to compile Java source code to class files without running the project.

Yes, it does this. By default is does this automatically every time you save the java source file. You can change this in the Preferences under General | Workspace. If you turn off automatic builds, you can right-click a project and select Build Project.


JBoss In Action
Greg Brannon
Bartender

Joined: Oct 24, 2010
Posts: 557
Good to know. Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: [Tutorial] How to Compile a Java program in Eclipse