Eclipse and OpenJDK 12

It seems the latest Eclipse and OpenJDK 12 don’t work together very well. Am going to have to back track to OpenJDK 11. (I know I had 10 working with an Eclipse from August.)

I use eclipse 4.10 (4.11 is the first supported version for JDK12?) and it gives me funny error messages like Object doesn’t exist no matter what i do regarding module-info.java etc.

Have you installed this patch already? https://marketplace.eclipse.org/content/java-12-support-eclipse-2019-03-411

Which problems are you having and what version of eclipse do you use? You didn’t give lots of information on that.

I gave up on JDK12 because Eclipse is rather broken.

Actually Eclipse doesn’t even seem to handle Java 9 all that well either. The module system stuff is just… borked in some way. I can’t quite put my finger on it but the IDE seems to actively try to break things for you. I think they need to throw their module stuff away and rethink it.

Cas :slight_smile:

I use Eclipse IDE 2018‑12 with OpenJDK 11 under GNU Linux (Mageia Linux) and it works correctly. I have used a very little bit the module system, it seems to work but I need to use a lot more to confirm or not whether it’s really stable. The rest goes on working. You absolutely need Eclipse IDE 2019-03 with OpenJDK 12.

The Eclipse I have that works with OpenJDK 11 is 2018-12 (4.10.0), running on my laptop.
On my desktop Neon version, I was also getting the Object does not exist messages, after upgrading from Java 10, jumping to 12.

I downloaded Eclipse 2019-03 (4.11.) but for me, it is not working well with OpenJDK 12. I’m getting an odd error message: “The project was not built due to ‘release 6 is not found in the system’. Fix the problem, then try refreshing this project and building it since it may be inconsistent”

When I get a chance (might not be until next week), I’m going to back track to OpenJDK 11. [EDIT: Given that 11 is LTS, maybe the sensible thing is to just leave it there until 17 or whatever the next LTS is.]

I’ll check out the link to the support patch for 12 at that time, first. Thanks for that!

I’m not counting on the modular stuff working all that well since it is both new and considerably different, and Eclipse depends on volunteers. That’s a big reason why I decided to figure out how to do the modular compiling and jlinking on the command line. I’m reconciled to that, for now. It is not a big burden.

I updated my Eclipse installation by enabling “Preferences->Install/Update->Available Software Sites->Latest Eclipse Release” and then running “Help->Check for updates”. The project builds now :stuck_out_tongue: Maybe that included a hotfix for 4.11 and JDK12.

Possibly not that odd a message. I presume the project is set to use Java 6 source level? Java 12 drops support for compiling Java 6. https://openjdk.java.net/jeps/182

Depends where you got OpenJDK 11 from - Oracle’s OpenJDK 11 isn’t an LTS.

I downloaded jdk 12.0.1 GA Release from http://jdk.java.net/12/

All the projects were set to Java 10 prior to this, in Eclipse. I left 6 behind long ago.

I wonder which article I read that said 11 was an LTS.

I can see where OpenJDK from Oracle says they don’t recommend using 11 or prior in production due to security concerns. I have to wonder if it affects my little applications if I’m only using a couple modules and am not reading input from external sources.

I wonder how the Eclipse organization is going to be able to keep up with the pace!

Because in general 11 is an LTS. But the only LTS from Oracle is the paid-for JDK. Their OpenJDK isn’t! For a free 11 LTS you’ll have to get it from a different vendor. There are a few, but I would recommend AdoptOpenJDK.

If you want the full “fun” read on all this try https://medium.com/@javachampions/java-is-still-free-2-0-0-6b9aa8d6d244

Eclipse 2019-03 (4.11.0) is now working for me with OpenJDK 12.0.1 & OpenJFX 11.2.
I obtained OpenJFX from openjfx.io, and the link provided in their documentation https://gluonhq.com/products/javafx/
Note that you have to download both an SDK and a jmods! Two downloads for OpenJFX.

I used the choice File/import/Existing Projects into Workspace, and had the projects copied into the new Workspace. Once this is done, I think we have to do the following to get the projects to work.

  1. Set the Java Compiler to Compiler compliance level 11 (the highest offered).

  2. On the Java Build Path, add a Library to the Modulepath (Classpath also seems to work but I’m not clear on whether one or the other is more correct). At the “Add Library” screen I selected “User Library”, and gave the New library the name “JavaFX11” (you can name it whatever you want). Then, with the library selected I clicked “Add External JARs” and navigated to the /lib folder of the installed JavaFX SDK. From there I selected all the .jar files, and these became the contents of the JavaFX11 library. This only had to be done once.

  3. Again from the Java Build Path, I went to Add Library and selected the new JavaFX11 User library. (This choice, with check box, should now always be present when you navigate to add a User Library.)

At this point all the weird errors had disappeared. :stuck_out_tongue:

However, to run the program, the Run Configuration has to be edited to include the following Argument (second tab):

VM arguments:

--module-path "c:\Program Files\Java\javafx-jmods-11.0.2" --add-modules=javafx.controls

Your command may differ if you have downloaded to a different location, or downloaded a different set of modules from Gluon. Note, this is the address of the jmods, not the SDK!

Also, if your program uses more than the basics of JavaFX, you might have to add additional modules (comma-separated) to the –add-modules command.

OK then.
By the way, I’m not making the code for my projects modular at this point. Instead I’m leaving them with no module-info file, which is also known as the “Unnamed Module”.

I haven’t tried to make a jar yet. I assume that I will build a self-contained folder instead for demos and distribution. To do this, I export source and do command line compilation and jlinking.

The last stages for packaging involve either adding a simple .BAT (Windows) or Bash command (MacOS) for distribution to computer-savvy folks, or I will use Inno-Setup 6 (Windows) or make a manual .app (for MacOS process described in another tutorial) for commercial distribution.

It is a workable solution and workflow for my small-scale projects. It may not be the best solution, but I’m happy to once again have a working dev environment and to go back to coding instead of effing around with this configuration crapola. If I’ve spared anyone else some of the misery I’ve gone through figuring this out, I will sleep better at night knowing I’ve done something useful.

Thanks for losing hair on our behalf Phil. I’m going to wait until it’s all rather more matured I think though. Too many things lurk waiting to jump out and disrupt my sleep.

Cas :slight_smile: