Bug 265719 - devel/pycharm-pro: requires JAVA_HOME pointing at a specific java version
Summary: devel/pycharm-pro: requires JAVA_HOME pointing at a specific java version
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Emanuel Haupt
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-08 15:04 UTC by Emanuel Haupt
Modified: 2023-03-02 08:05 UTC (History)
3 users (show)

See Also:
guido: maintainer-feedback+


Attachments
patch to set JAVA_VERSION in bin/pycharm-pro (335 bytes, patch)
2022-09-25 15:53 UTC, Steve Wills
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Emanuel Haupt freebsd_committer freebsd_triage 2022-08-08 15:04:39 UTC
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.
Comment 1 Guido Kollerie 2022-09-25 06:07:09 UTC
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.
Comment 2 Steve Wills freebsd_committer freebsd_triage 2022-09-25 15:53:47 UTC
Created attachment 236815 [details]
patch to set JAVA_VERSION in bin/pycharm-pro
Comment 3 Emanuel Haupt freebsd_committer freebsd_triage 2022-09-25 16:46:24 UTC
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...
Comment 4 Guido Kollerie 2022-09-25 16:53:12 UTC
Thank you Steve for the patch and Emanuel for testing it. I've set maintainer-feedback to +
Comment 5 Emanuel Haupt freebsd_committer freebsd_triage 2023-03-02 08:04:58 UTC
Sorry for the delay. I've commited swills' patch.
Comment 6 commit-hook freebsd_committer freebsd_triage 2023-03-02 08:05:14 UTC
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(+)