On Mon, 05 Feb 2018 16:18:25 +0000
Neil C Smith <neilcsm...@apache.org> wrote:
>
> That's only going to work if the netbeans_jdkhome is commented out in
> the conf file I think - by default the installer sets it.

jem will manage your JAVA_HOME env var, along with java/javac and other
commands that get linked to a script/wrapper.
https://travis-ci.org/Obsidian-StudiosInc/jem/builds/336248733#L1024

Its actually controlled by nbexec which calls netbeans script that has
netbeans_jdkhome.
https://github.com/apache/incubator-netbeans/blob/master/ide/launcher/unix/netbeans#L193

 --jdkhome <path>      path to Java(TM) 2 SDK, Standard Edition
https://github.com/apache/incubator-netbeans/blob/master/o.n.bootstrap/launcher/unix/nbexec#L71

But also has some logic to look
https://github.com/apache/incubator-netbeans/blob/master/o.n.bootstrap/launcher/unix/nbexec#L134

Pretty sure nbexec calls netbeans script. It can be invoked either way
I believe, directly calling netbeans script. But one seems to be a env
wrapper for the other. They end up in different locations one in lib
one in bin its odd. Seems like they should be together or 1 script.

./platform/lib/nbexec
./bin/netbeans

I plan to re-write both for Gentoo. Those are universal and most not
needed for a known env, specific distro.

> On a Debian derivative, you can use update-alternatives to achieve
> similar to jem (I assume?).  Just make sure to set both java and
> javac - it's the location of javac that takes precedence, or at least
> does in a platform app, which caused some interesting head scratching
> with a user a while back! :-)

Yes alternatives is similar but different. Alternatives is more
comparable to Gentoo's eselect. Which mostly toggles symlinks between
this or that for a given program library etc.

https://wiki.gentoo.org/wiki/Project:Eselect/User_guide
https://wiki.debian.org/DebianAlternatives

Those are for more limited stuff. They will not help you say build a
classpath for packages. Though I believe altenratives can be used to
select virtual providers for things. It is still pretty different.

Alternatives I believe is a set this or that. It does not allow you to
use both or more than one same time. With jem you can use different vms
sametime or to test at runtime

JEM_VM=oracle-jdk-bin-10
JEM_VM=oracle-jdk-bin-9

While leaving other vms set to say 1.8 or other for like applications
like Tomcat, or UI stuff netbeans, etc.

> You can also pass --jdkhome on the command line rather than setting
> it up in the conf file, so you could create 3 script files
> or .desktop files to do that?

Yes and in this case would not need to do that. Could just do

Run nb under 9
JEM_VM=oracle-jdk-bin-9 netbeans

Or 10
JEM_VM=oracle-jdk-bin-10 netbeans

Paths are not ideal as they tend to have versions and if you put that
in a script and version changes it breaks. You can get around with
wildcards etc. But there is more to it than that.

Long term I want to have jem work with like maven pom.xml local repos.
So it could build a runtime classpath based on pom.xml, or package.env
files.

Like if I needed a classpath for netbeans-core-startup for a stand
alone application, including any runtime deps, deps of deps.

-d, --with-dependencies
-p, --classpath=PACKAGE(s)

$ jem -dp netbeans-core-startup-9
/usr/share/asm-6/lib/asm.jar:/usr/share/netbeans-core-startup-base-9/lib/netbeans-core-startup-base.jar:/usr/share/netbeans-o-n-bootstrap-9/lib/netbeans-o-n-bootstrap.jar:/usr/share/netbeans-openide-filesystems-9/lib/netbeans-openide-filesystems.jar:/usr/share/netbeans-openide-modules-9/lib/netbeans-openide-modules.jar:/usr/share/netbeans-openide-util-9/lib/netbeans-openide-util.jar:/usr/share/netbeans-openide-util-lookup-9/lib/netbeans-openide-util-lookup.jar:/usr/share/netbeans-openide-util-ui-9/lib/netbeans-openide-util-ui.jar:/usr/share/aqute-jpm-clnt/lib/aqute-jpm-clnt.jar:/usr/share/bndlib-3/lib/bndlib.jar:/usr/share/bnd-annotation-3/lib/bnd-annotation.jar:/usr/share/libg-3/lib/libg.jar:/usr/share/osgi-annotation/lib/osgi-annotation.jar:/usr/share/osgi-compendium-6/lib/osgi-compendium.jar:/usr/share/osgi-core-api-6/lib/osgi-core-api.jar:/usr/share/osgi-ds/lib/osgi-ds.jar:/usr/share/osgi-util/lib/osgi-util.jar:/usr/share/slf4j-api/lib/slf4j-api.jar:/usr/share/eclipse-javax-persistence-2/lib/eclipse-javax-persistence.jar:/usr/share/osgi-foundation/lib/osgi-foundation.jar:/usr/share/tomcat-servlet-api-4.0/lib/el-api.jar:/usr/share/tomcat-servlet-api-4.0/lib/jsp-api.jar:/usr/share/tomcat-servlet-api-4.0/lib/servlet-api.jar:/usr/share/netbeans-core-startup-9/lib/netbeans-core-startup.jar


-- 
William L. Thomson Jr.

Attachment: pgpa4377bgWoH.pgp
Description: OpenPGP digital signature

Reply via email to