Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Using Eclipse compiler standalone with Java 11?(Which version can I use, if any)
Using Eclipse compiler standalone with Java 11? [message #1797805] Tue, 06 November 2018 10:09 Go to next message
Eclipse UserFriend
Hi,
I'm experimenting with building a Java8-project with Java 11 and I managed to get it to work inside Eclipse by installing the JDT BETA_JAVA11 plugin .
I also need to build the project outside eclipse with ECJ, but so far no luck.

I'm guessing that I can download org.eclipse.jdt.core-3.15.100.v20180928-0501_BETA_JAVA11.jar and use that inside my ant/gradle build file to access the compiler (?)
I've already tried the standalone distribution of ecj-4.9 and ecj-4.10M1 with no success and suspect that those two don't have the required support.

This could very well be a problem on my end, but before I spend too much time on it, could anyone tell me if either of these should work.

Or should I just wait for the Eclipse 4.10 released before trying to do this?

TIA,
Chris

Re: Using Eclipse compiler standalone with Java 11? [message #1797815 is a reply to message #1797805] Tue, 06 November 2018 14:59 Go to previous messageGo to next message
Eclipse UserFriend
Quote:
I've already tried the standalone distribution of ecj-4.9 and ecj-4.10M1 with no success and suspect that those two don't have the required support.


ecj.jar is indeed better suited for batch compilation, since org.eclipse.jdt.core either needs additional dependencies or a parameter "-proc:none".

ecj-4.10M1 contains the support for Java 11, just try by invoking
$java -jar ecj-4.10M1.jar -11 MyClass.java


If you already work with ecj via ant you've probably seen this: http://help.eclipse.org/topic/org.eclipse.jdt.doc.user/tasks/task-ant_javac_adapter.htm

If you still have problems, what exactly doesn't work? How?

Stephan
Re: Using Eclipse compiler standalone with Java 11? [message #1797832 is a reply to message #1797815] Wed, 07 November 2018 03:23 Go to previous messageGo to next message
Eclipse UserFriend
Hi Stephan and thanks for the quick response!

We've been using ECJ from ant for years without problems with that ant task, but I cannot not get it to work with J11. It is probably because of our use of some Java EE components that now require us to use modules so I'm most likely doing the modules-part wrong. So I kind of gave up on ant and started looking at porting our build to gradle to get dependency management for those things.
In gradle I can get javac to build the code, but ECJ fails in a way where I can't seem to get any meaningful error message which made me suspect that I didn't have a jar with the right support. But with your answer, I can now safely say that the problem is in my build files and not in ECJ, so I can continue to figure out how this should be set up in gradle and/or ant.

Thanks again!
Re: Using Eclipse compiler standalone with Java 11? [message #1797847 is a reply to message #1797832] Wed, 07 November 2018 07:07 Go to previous messageGo to next message
Eclipse UserFriend
Hi again,

after some more work, I'm starting to lean towards there being something wrong with ECJ after all, or maybe just a lack of error handling. I can run my gradle build with javac without issues, but when I switch over to the ECJbuild, I can trigger two different nullpointers from the compiler, depending on how I call it.

attempt 1:
----------
java.lang.NullPointerException
at org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding.getMemberType(ParameterizedTypeBinding.java:797)
at org.eclipse.jdt.internal.compiler.lookup.Scope.findMemberType(Scope.java:1544)
at org.eclipse.jdt.internal.compiler.lookup.Scope.getMemberType(Scope.java:2903)
at org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.findNextTypeBinding(QualifiedTypeReference.java:53)
<...>
----
attempt 2
----
java.lang.NullPointerException
at org.eclipse.jdt.internal.compiler.lookup.ModuleBinding$UnNamedModule.canAccess(ModuleBinding.java:73)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.combine(LookupEnvironment.java:355)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:345)
at org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:112)
at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:231)
<...>
----

I tried to extract the command that gradle will run and I can repeat the issue with a commandline call of ecj.
I'm not ruling out that there's something seriously wrong with my setting of the paths, but I shouldn't be seeing a these exceptions even if I feed garbage to ECJ, right?

I can try to provide more detailed information on what parameters I used if it is any help, but unfortunately I can't show how to repeat it since it is company-internal code.
Re: Using Eclipse compiler standalone with Java 11? [message #1798057 is a reply to message #1797847] Sun, 11 November 2018 23:47 Go to previous messageGo to next message
Eclipse UserFriend
Hello Chris,

Yes, you shouldn't be seeing the NPE. Please raise a bug with the details, so we can take this forward.

Jay
Re: Using Eclipse compiler standalone with Java 11? [message #1798066 is a reply to message #1798057] Mon, 12 November 2018 02:39 Go to previous message
Eclipse UserFriend
Hi Jay,

I reported this bug here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=541015
I only reported the module-related backtrace as someone else already reported something very similar to the other of my crash backtraces here https://bugs.eclipse.org/bugs/show_bug.cgi?id=540951
Previous Topic:How to install Dr. Garbage "bytecode visualizer" in Eclipse?
Next Topic:Eclipse Photon ( for Java EE) stuck at starting up
Goto Forum:
  


Current Time: Sun Jul 13 23:17:37 EDT 2025

Powered by FUDForum. Page generated in 0.05645 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top