jdee icon indicating copy to clipboard operation
jdee copied to clipboard

jdee with openjdk 11.0.x

Open maneum1 opened this issue 5 years ago • 3 comments

My Emacs version:26.1

My JDEE version (elpa package date):20190217.1029

My JDK version: openjdk 11.0.1

My Operating System (Linux/OSX/Windows X/Other): ubuntu and windows

Stacktrace (if applicable):

How to reproduce (if applicable):

Other info you consider could help to fix it:

jdee-jdk-registry is populated with openjdk-11 and it is checked in jdee-jdk. I'm trying to use openjdk 11.0.1 with jdee but when opening a .java file it appears that the registration of the jdk did not work "The JDE does not recognize JDK 11.0 javac. Assume JDK 10.0 javac?(yes or no)" Any advise is appreciated. Thanks Martin

maneum1 avatar Feb 26 '19 06:02 maneum1

I have been using Open JDK 12.0.1 and it worked when I typed "yes". As a work around I used the instructions here http://jdee.sourceforge.net/jdedoc/html/jde-ug/jde-ug-content.html#RegisterSelectJDK to name my version "10.0" so I didn't get the notification anymore.

baBounch avatar May 07 '19 14:05 baBounch

On Mac OS, I have the following output from java -version which is not compatible with jdee-java-version-via-java.

$ java -version
openjdk version "12.0.1" 2019-04-16

This gives me a JDK version of "1".

Compare with the output of Java 8:

$ /Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home/bin/java -version
java version "1.8.0_112"

The regexp and surrounding logic needs to be fixed: https://github.com/jdee-emacs/jdee/blob/1b1bdf01864d38173c9972234b02f81b47781757/jdee-jdk-manager.el#L45

malthe avatar Jul 22 '19 21:07 malthe

I just recently got OpenJDK 14 to work correctly, thought I'd share steps I did.

First thing I did was set the environment variable JAVA_VERSION to 14.0. If this environment variable is set, JDEE won't try to determine the JDK version from the executable. However, without the .0, the above mentioned regexp functions fail. So this sets the version in a way that continues to function.

Next I had to make modifications to the jdee-server code. Starting in Java 9 there is no longer an rt.jar or tools.jar. Because those are no longer present, the jdee-server code can no longer identify any java. or javax. classes, so the jdee import functions won't find any of those classes.

What I changed was to add to the ProjectClasses capability in the jdee-server project the ability to read the system modules and add the classes to the cache from the modules. Doing so works but effectively pins me to Java 9 or later as the jdee-server jar can no longer execute on Java 8.

Mictali avatar Jun 25 '20 15:06 Mictali