Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions platform/o.n.bootstrap/launcher/unix/nbexec
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,22 @@ if [ -z "$jdkhome" ] ; then
jdkhome="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home"
fi
;;
*) javac=`which javac`
if [ -z "$javac" ] ; then
java=`which java`
if [ ! -z "$java" ] ; then
java=`resolve_symlink "$java"`
jdkhome=`dirname $java`"/.."
fi
*)
if [ ! -z "${JAVA_HOME}" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • this code reads the JAVA_HOME environment variable
  • the Open file from embedded terminal, easily! #8756 PR does something similar for --userdir, but it also
  • sets the environment variable
  • so child processes find the same value even if it was only specified by CLI argument

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know enough about how NetBeans handles multiple Java enviroments to comment on whether that's a good idea.

In some IDEs the Java that runs the IDE is independent from the Java(s) used for the projects.

IMO such a change would better be done from the Java side, as this patch only touches the non-Apple Unix path, and the java code would be a common path instead of threeseparate ones (MacOS, generic unix, Windows)

jdkhome="${JAVA_HOME}"
else
javac=`resolve_symlink "$javac"`
jdkhome=`dirname $javac`"/.."
# Doesn't work with jenv-style shims
javac=`which javac`
if [ -z "$javac" ] ; then
java=`which java`
if [ ! -z "$java" ] ; then
java=`resolve_symlink "$java"`
jdkhome=`dirname $java`"/.."
fi
else
javac=`resolve_symlink "$javac"`
jdkhome=`dirname $javac`"/.."
fi
fi
;;
esac
Expand Down
Loading