views:

116

answers:

5

I've set up Eclipse in Ubuntu 10.04. I currently have the OpenJDK JRE installed but don't have the JDK needed to compile.

However, the code written Eclipse still compiles. Is this a standard compiler included in Eclipse? I've searched through the package manager and don't seem to have any of the JDKs installed...

Note: running 'javac' in the terminal doesn't work.

+6  A: 

If you download Eclipse from eclipse.org, it will bring everything it needs to work with it.

Eclipse is designed to be a standalone package which only minimally uses the components of the system on which it runs. This helps to provide the same experience everywhere.

On the down side, it makes Eclipse larger and more RAM-hungry, and also makes keeping Eclipse up-to-date a separate chore from keeping the rest of your system current.

You can see what Eclipse is using by going into your project build settings. It may be using its built-in compiler, which lets it easily highlight errors, rapidly do incremental builds, and such.

Borealid
See also http://stackoverflow.com/questions/3061654/what-is-the-difference-between-javac-and-the-eclipse-compiler
Andrew Niefer
A: 

Eclipse, like unfortunately most substantial applications that require a JRE/JDK to run include it in the distribution.

For a good time on Lucid Lynx:

$ locate javac
msw
+1  A: 

Eclipse does come with its own compiler, but I wouldn't recommend using it for distribution of source code. I'm not intimately familiar with it, but I've been told that it doesn't perform optimizations as well as other compilers and there are some known bugs in it. I can't dig up anything that supports this, but I do like the idea of building using the same JDK/compiler and running on the same JVM that your users are.

I would suggest obtaining the Sun JDK for Linux. You should be able to get it from the Synaptic Package Manager if you open the universe repositories.

Thomas Owens
A: 

For what it's worth, the Java compiler included in Eclipse is a derivative of IBM's jikes compiler. It's not really so important what brand it is; what's important is that it is an incremental compiler; it sort of keeps your whole program inside itself and if you change a class (maybe even just a method) it will re-compile just the bit of code you've changed.

If you look at NetBeans, when you save a changed file it will call up an ant task to re-compile (via the JDK) at least the class you changed, maybe more. When your classes start to get bigger, you'll find (or at least I did) that this takes up a lot of time; I'm very happy with Eclipse (and IBM) for doing things the way they do. Without the external compilation step, code changes take place a lot more quickly.

Yes, the compiler has some differences compared to the "standard" compilers by Sun Oracle and OpenJDK. But I've never experienced a problem as a result. Still, for production use I'd recommend formally compiling using ant or maven and the JDK. Just to be on the safe side.

Carl Smotricz
+1  A: 

There's a package for eclipse called (suprisingly :) ) eclipse and the java compiler (javac) is in sun-java6-jdk

Install it with sudo apt-get install sun-java6-jdk or sudo apt-get install eclipse

fireDude67