1

Newbie on eclipse, I have a naive questions.

I have found nowhere in Eclipse to execute the equivalent command line "javac". If I understand well, "run" from the menu of Eclipse processes as javac + java. So my question is: Under Eclipse, how can we compile a .java with "javac" only ? Thanks.

For information, I notice this similar post How to run Javac from Eclipse does not answer my question. Mine is to "compile a .java file without running anything"

Community
  • 1
  • 1
zell
  • 9,830
  • 10
  • 62
  • 115

2 Answers2

7

Well, you can make Eclipse run Ant for you... but normally you just get Eclipse to compile the code for you with its built-in compiler. There's no need for javac.

By default, Eclipse will build every time you save - you don't need to explicitly build at all. When you use "Run" in Eclipse, it doesn't need to compile at that point, because the code has already built.

If you want to find the class files, just look under your output directory.

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
  • Do you really want it to "normally" be built with Eclipse's internal compiler? I would much rather have an external compiler with an ant script so I can guarantee that what I'm compiling is doing the exact same steps that my automated build (the artifacts of which are what ultimately will be going to QA) are taking. – corsiKa Sep 09 '11 at 18:05
  • 1
    @glowcoder: I want it to be built with Eclipse's extremely fast incremental compiler for most of the time, yes - and then a separate compiler when I'm preparing for a release or whatever (and to run tests before committing etc). If you have enough faith in your tests to cover the very occasional differences between the compilers, why not take advantage of a really quick turnaround time? – Jon Skeet Sep 09 '11 at 18:21
4

Eclipse should build your projects automatically so you don't need to call javac

luketorjussen
  • 3,156
  • 1
  • 21
  • 38