How to configure a non-eclipse Java compiler for the Eclipse IDE

I noticed that the Eclipse IDE (for Java, version 3.5.1) uses its own java compiler (s), but I cannot find how to change it. Is it possible?

This may be a little trivial, but after many years of using IntelliJ IDEA, I find returning to Eclipse a bit uncomfortable.

Thanks.

UPDATE: after a more detailed explanation has been requested, I do this.

So, I recently helped some Java developers and noticed that it uses Eclipse without the Sun JDK. Since we use only the Sun JDK across the company, I found this rather strange.

It turned out that he only has Eclipse, and no additional tools for compiling java code (for example, javac) are required. This is because Eclipse comes with its own compiler (more on this).

By myself, I find this feature pretty enjoyable, and I think there are good reasons for this. But I would like all the developers of our company to use the same compiler to generate java bytecode (.class files). And run it in one JVM. Just to make the environment as uniform as possible and eliminate additional environmental problems. I have no problem specifying JRE in Eclipse.

But I could not find how to change the default Java compiler to javac. On the other hand, my main IntelliJ IDEA IDE allows you to do this (choose between javac, jikes, or eclipse compilers). So I just wanted to know if this is possible in Eclipse or not.

Additionally:

  • No, I have no real problems with the Eclipse compiler as such, it's just a matter of choice.
  • I know that Apache Ant and other solutions can be used to compile Java code with any compiler. But here I am interested in Eclipse and its integrated project construction (for example, menu items in the Project menu).
+6
java eclipse
source share
4 answers

What would you like? If you want classes created by the Sun compiler, you can create them using Ant. Eclipse uses its own compiler because the Sun compiler is not intended for use in a compiled environment.

On the JDT website:

Java incremental compiler. Implemented as an Eclipse builder, it is based on technology developed from VisualAge for the Java compiler. In particular, it allows you to run and debug code that still contains unresolved errors.

Keep in mind that for the library itself, Eclipse will still use one of the Sun compiler, which can be installed using the procedure explained by the other answers (NimChimpsky and The Elite).

+4
source share

Here's how to add your own JDK / JRE:

  • Open the Windows menu β†’ Preferences .
  • In the Settings window, select Java β†’ Installed JREs from the drop-down list on the left.
  • Click on Add bitton (on the right), select Standard VM , then a dialog box with the Add JRE heading will appear.
  • In the JRE home : field, click the directory button and navigate to the root JRE / JDK folder. After selecting it, it will be automatically completed and completed.

Once you're done, go back to the Preferences window and check the radio button for your added JRE / JDK to make it the default.

Hope this helps.

+2
source share

Although I was also looking for this, the only solution I found was to use Maven. With the maven-compiler-plugin, you can specify the compiler to use, and eclipse will delegate to it. I hope this trick can be done for Ant-based projects.

  <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <compilerId>javac</compilerId> <encoding>${project.build.sourceEncoding}</encoding> </configuration> <dependencies> <dependency> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-compiler-javac</artifactId> <version>1.6</version> </dependency> </dependencies> </plugin> 

dp4jmaventest is a working demo using this configuration.

Error 341842 is a request to the Eclipse function for such support.

+1
source share

right click on project> properties> java compiler

0
source share

All Articles