This question got me thinking, assuming a Sun JDK is available, why would I use anything else? Is there a good technical reason for using a different compiler?
-
1In don't believe this question belong here, but in the dark days of pre-1.4, the IBM JDK was actually a lot faster than the Sun one. And the jikes compiler ruled. – Paul Tomblin Oct 12 '10 at 14:25
-
licensing/distribution agreements differs from different vendors... – chrismh Oct 12 '10 at 14:27
-
Also, don't you mean the Oracle JDK ;) – jamiebarrow Oct 12 '10 at 15:32
-
The header is inconsistant with the body of the question. – Thorbjørn Ravn Andersen Oct 12 '10 at 16:22
-
This questions really looks dark, I mean the following is not true "Compilers built into IDE's usually have superior error reporting." – Raul Lapeira Herrero Oct 12 '10 at 16:26
-
jikes wasted me a lot of time because of its bugs, and the company dropped it eventually. compile time is not important during dev - usually on a few java files need to be compiled at a time - I don't have any memory that jikes being faster. – irreputable Oct 12 '10 at 16:59
4 Answers
Well, I'm sure people don't realize it, but Eclipse has its own compiler. So, when you are using Eclipse, you are using a nun-Sun(Oracle) JDK.
There are many advantages to using this too. First off, Eclipse actually has a few compilers built in. The one the provides the most benefit, IMO, is the one that provide the red underlines as you type.
Another thing that the Eclipse compiler does is 'compiles' uncompilabe code. So, if you run a piece of code, and never hit the code that couldn't compile, the code will run without error. Otherwise you get a NotYetCompiledException
. (Or something like that)

- 136,852
- 53
- 295
- 323
-
OK, fair enough. But in the case of plain-vanilla command line compiles, is there a good technical reason to use something else? – Dave Oct 12 '10 at 14:35
-
-
what do you mean by Eclipse has a few compilers built in? There are many APIs (high-level AST, low-level AST, internal AST), many customization options (what is a warning, what is an error), but I know of only one compiler (symbol parser, bytecode generator, etc.) – Barthelemy Oct 13 '10 at 11:23
A lot of people are answering a different question than what you asked. The JDK used to compile the code is different from the JVM used to run it.
Because most optimization occurs JIT, the quality of generated code from your compiler is not very important. This leaves the reason to use a particular JDK as:
- Compile performance. At one time IBM Jikes was a very fast compiler.
- Error reporting. Compilers built into IDE's usually have superior error reporting.
- Standards compliance. For example, at one time IBM provided an extra overloaded method in StringBuilder. If that overload was selected at compile time then your code would fail at runtime on a Sun JVM.

- 21,309
- 5
- 49
- 53
-
According to Darron "The JDK used to compile the code is different from the JVM used to run it."??!!, just copied it here to prevent further editing. Who voted this answer? – Raul Lapeira Herrero Oct 12 '10 at 16:28
-
1@Raul Darron is right. When you compile your code in Eclipse you use Eclipse compiler, and when you run it, you will use another VM (Sun, IBM, JRockit, etc.). – Barthelemy Oct 13 '10 at 11:27
-
@Barthelemy I disagree it is a good practique using a compiler that is provided from other source than the execution environment, but is only my oppinion. – Raul Lapeira Herrero Oct 13 '10 at 14:30
If you're a WebLogic user, JRockit makes a lot of sense. It's a terrific JVM. I'm not sure that it runs on all operating systems, though.

- 305,152
- 44
- 369
- 561
-
-
@duffymo What's the difference? There is no Sun or BEA (in much of the world). – Tom Hawtin - tackline Oct 12 '10 at 14:53
-
1The origins are unchanged, regardless of merger activity that's happened since. The only way it fails to matter is if Oracle has merged the two together so they are one technology rather than two. Do you know that it's happened? If not, it's still possible to choose between the Sun and JRockit JVMs when you run WebLogic. – duffymo Oct 12 '10 at 14:55
-
-
@BacMan - "terrific" because of the performance optimizations they built into it. – duffymo Oct 12 '10 at 15:41
-
+1 just because someone downvoted it. JRockit is a reasonable alternative. We once had to compare the performance of IBM, JRockit and Sun JDK in a compiler class and JRockit was significantly (but not by much) faster than Sun JDK for long-running apps (two-three yrs ago). IBM jdk was in a league on its own though. – Barthelemy Oct 13 '10 at 11:25
-
-
1"Is there a good technical reason for using a different compiler?" - yes, it did. It gave one reason for choosing a non-Sun JVM: better performance when deploying on WebLogic. The one thing I don't see is an answer from you, BacMan, only a down vote and a useless comments. Let's see your answer. – duffymo Oct 13 '10 at 18:50
-
-
-
Not much in almost two years. For god's sake, put some answers out there, BacMan. – duffymo Oct 14 '10 at 01:30
Wait a second, if you use JRockIt or whatever other JRE you are going to lose portability, no matter what commercials tell you: it is never 100% portable neither 100% standard.
In fact many consider making you switch the JRE part of the Embrace, extend and extinguish strategy, sometimes is the "only recomended way" to solve an issue.
http://en.wikipedia.org/wiki/Embrace,_extend_and_extinguish
Promise, I suffered this years ago and paid for it :(

- 891
- 5
- 19