[Bug 259468] java/javavmwrapper: Add a java_home command?
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 26 Oct 2021 23:47:04 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=259468 Bug ID: 259468 Summary: java/javavmwrapper: Add a java_home command? Product: Ports & Packages Version: Latest Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: Individual Port(s) Assignee: glewis@FreeBSD.org Reporter: tom@hur.st Flags: maintainer-feedback?(glewis@FreeBSD.org) Assignee: glewis@FreeBSD.org JRuby's launchers currently attempt to determine JAVA_HOME by resolving symlinks - it uses this mechanism to determine if the JVM has modules support, which necessitates calling java with various `--add-opens` flags for fully-featured operation. This obviously doesn't work on FreeBSD, as it just resolves to /usr/local/bin: https://github.com/jruby/jruby/issues/6905 Manually setting JAVA_HOME works around this, but is obviously not an ideal solution. The best fix would seem to be for javavmwrapper to offer a mechanism to determine the configured JAVA_HOME, and there seems to be precedent for such a feature on other platforms which offer similar functionality in the form of a `java_home` command: https://medium.com/notes-for-geeks/java-home-and-java-home-on-macos-f246cab643bd > java_home - return a value for $JAVA_HOME > > -v or --version version > Filters the returned JVMs by the major platform version in "JVMVersion" form. > Example versions: "1.5+", or "1.6*". > -V or --verbose > Prints the matching list of JVMs and architectures to stderr. > --exec command ... > Executes the command at $JAVA_HOME/bin/<command> and passes the remaining arguments. > Any arguments to select which $JAVA_HOME to use must precede the --exec option. For JRuby's purposes only the most basic functionality would be required, with the rest perhaps a nice-to-have. This might also be nice for heavy Java users - manually setting JAVA_HOME cuts out most of javavmwrapper's overheads (in my case, 95ms becomes 15ms), and this would allow it to be set without manually hardcoding it. Does this seem reasonable? -- You are receiving this mail because: You are the assignee for the bug.