I poked around a bit with the netbeans.desktop file and got netbeans (snap
or not) to pick up sdkman's default jdk with
Exec=bash -c "[[ -s /home/pata/.sdkman/bin/sdkman-init.sh ]] && source
/home/pata/.sdkman/bin/sdkman-init.sh && netbeans %F"

It's far from pretty and far from generic, but it might serve as some kind
of inspiration.
I'll use since it's easier for me to maintain after snap updates instead of
creating and editing netbeans.conf files.

/Patrik

Den mån 27 apr. 2020 kl 18:58 skrev Laszlo Kishalmi <
[email protected]>:

> Well, I'm not a Snap pro either, but I brought NetBeans to Snap.
>
> With SDKMan, it seems the issue is that the GUI environment has no idea
> of what is the default JDK (more simply it is not on the path when the
> XSession starts). I guess it sets something in the profile scripts. We
> might try to read that during the IDE execution. It not a Snap issue,
> I'd guess it might affect other distributions as well. Luckily the
> installed distribution sets the jdkhome in netbeans.conf during the
> installation.
>
> NetBeans Snap runs in classic confinement, which means it is not
> sandboxed. Probably it is not too much that Snap brings on the table,
> but it is certain that is not additional complexity. Here is a short
> list why I think it is useful:
>
>   * Native Linux packages provide old versions (8.2 and 10.0 in case of
>     Debian)
>   * It is installed per system not per user, so it can be really
>     convenient to be installed on computers which used by many people,
>     just think about an university computer lab.
>   * It provides automatic updates, I think I like this one the most
>     especially netbeans-dev which provides a weekly build from the master
>   * It provides ability to switch between beta-s and latest stable
>     versions really easy.
>   * Basically if you have Snap and a JDK installed on Linux it is the
>     easiest way to install NetBeans
>   * Due to our efforts it provides a same day availability with the
>     official NetBeans release (even betas).
>
>
> On 4/27/20 9:03 AM, Benjamin Asbach wrote:
> > Hi Patrick,
> >
> > Disclaimer: Not a snap pro.
> >
> > from my understanding that's the point behind a snap is to bundle all
> > it's dependencies and separate it from the rest of the system. So
> > combining sdkman and NetBeans snap doesn't seem the right way for me.
> >
> > When it works from command line vs via Desktop icon - for me that's an
> > indicator that the environment is somehow different. Maybe you don't
> > execute the snap from command line? `which netbeans` should bring a
> > little bit more light into that.
> >
> > Personally I don't see that much benefit from using NetBeans snap
> > version. It adds a layer of complexity without providing much of benefit.
> >
> > ---
> > Thanks
> > Benjamin
> >
> > On 2020-04-25 09:24, Patrik Karlström wrote:
> >> After a fresh install of Kubuntu I decided to use only sdkman for
> >> managing
> >> java on my system.
> >> Doing so rendered the NetBeans snap unstartable from the gui icon,
> >> with no
> >> error message what so ever.
> >>
> >> It did start nicely from the terminal though.
> >> My solution to this was to create and edit a netbeans.conf setting the
> >> netbeans_jdkhome option.
> >>
> >> Being a snap, this step is not really obvious,
> >> and the lack of an error message in combination with the fact that it
> >> does
> >> work from a terminal might be a bit confusing.
> >>
> >> Would it be possible to let the netbeans.desktop pick up the
> >> environment as
> >> if netbeans was started from a terminal?
> >>
> >> /Patrik
>

Reply via email to