• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

[Tutorial] How to Compile a Java program in Eclipse

 
Greenhorn
Posts: 4
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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/
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Ranch Hand
Posts: 49
Spring Redhat Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nice attempt to get people on board with Eclipse and Java!
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In step 5, I would click the "public static void main(String[] args)" checkbox.
 
Bartender
Posts: 563
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Greg Brannon
Bartender
Posts: 563
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good to know. Thanks.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic