I have both java/openjdk8 and java/openjdk11 installed. When running pycharm-pro I get the following error message: --- error begins here --- Error occurred during initialization of VM java.lang.UnsupportedClassVersionError: com/intellij/util/lang/PathClassLoader has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:756) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:473) at java.net.URLClassLoader.access$100(URLClassLoader.java:74) at java.net.URLClassLoader$1.run(URLClassLoader.java:369) at java.net.URLClassLoader$1.run(URLClassLoader.java:363) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:362) at java.lang.ClassLoader.loadClass(ClassLoader.java:418) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352) at java.lang.ClassLoader.loadClass(ClassLoader.java:351) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) at java.lang.SystemClassLoaderAction.run(ClassLoader.java:2202) at java.lang.SystemClassLoaderAction.run(ClassLoader.java:2188) at java.security.AccessController.doPrivileged(Native Method) at java.lang.ClassLoader.initSystemClassLoader(ClassLoader.java:1449) at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:1429) --- error ends here --- Setting JAVA_HOME to /usr/local/openjdk11 will fix the issue: $ JAVA_HOME=/usr/local/openjdk11 pycharm-pro IMHO this should be either handled by a wrapper or at least a pkg-message notice for the user.
I am not sure how Java dependent ports should deal with multiple installed versions of Java. The pycharm-pro port does specify that it requires JDK11 or higher in its port Makefile: https://github.com/freebsd/freebsd-ports/blob/b7f05445c00f2625aa19b4154ebcbce5ed2daa52/devel/pycharm-pro/Makefile#L26 In the mean time a message in pkg-message reiterating that required dependency seems like a good idea. Thing is I currently don't have a FreeBSD environment at hand to make the changes to the port. Maybe in the near future. Hence I'll keep the issue open.
Created attachment 236815 [details] patch to set JAVA_VERSION in bin/pycharm-pro
Works like a charm, thank you. Can you commit it? Given the fact that the maintainer doesn't currently use FreeBSD I'm sure he won't mind...
Thank you Steve for the patch and Emanuel for testing it. I've set maintainer-feedback to +
Sorry for the delay. I've commited swills' patch.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=127451b6c3ed80d6ecb05bf6b4877aaf83675bc7 commit 127451b6c3ed80d6ecb05bf6b4877aaf83675bc7 Author: Steve Wills <swills@FreeBSD.org> AuthorDate: 2023-03-02 08:02:53 +0000 Commit: Emanuel Haupt <ehaupt@FreeBSD.org> CommitDate: 2023-03-02 08:02:53 +0000 devel/pycharm-pro: Set JAVA_VERSION in bin/pycharm-pro PR: 265719 Approved by: guido@kollerie.com (maintainer) devel/pycharm-pro/Makefile | 1 + devel/pycharm-pro/files/pycharm.in | 4 ++++ 2 files changed, 5 insertions(+)