Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

How does a java source code compile in eclipse ?

Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I create a new java class in notepad, I have to explicitly compile this class to create class file out of this source java code.
When I craete java classes in eclipse project, do I need to compile these classes OR do they automatically get compiled ? If these classes are compiled by themselves, at what time do they get compiled after finishing coding of class OR when there is no syntax error, this source code creates class file and every time new source code is added, that keeps compiling ?
Posts: 3648
Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In eclipse there is a "Build automatically" under the Project menu. If selected, then the java source will compile automatically.

Explicit compilation is basically done when you export the project to a JAR file or manually select/click "Build". Once build you should able to run the project inside eclipse but I personally don't. I use the jar and run it in the command prompt. Or for web projects deploy the WAR to Tomcat and run it there.
Saloon Keeper
Posts: 22495
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As long as the auto-compile feature is turned on, Eclipse will re-compile the class each time you save changes to it. Auto-compilation is turned "on" by default.

On large projects, the built-in Eclipse builders aren't sufficient - for example when I need to not only compile, but also to assemble a WAR or EAR. For that level of building, I use Ant or Maven, both of which have plugins allowing them to be controlled within Eclipse. For policy reasons, all my projects can be built on non-GUI (non-Eclipse) machines. In large part because I have been seriously burned by IDEs that had gone obsolete by the time I needed to make emergency repairs to an app. Command-line builders are more stable. Eclipse is my helper, but not my crutch.
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic