Synology: Java-Installer 2.16 sets wrong JAVA_HOME path?

All your suggestions, requests and ideas for future development
Post Reply
User avatar
pspzockersceneJDown
Posts: 2
Joined: 01 Jul 2021, 12:11

Synology: Java-Installer 2.16 sets wrong JAVA_HOME path?

Post by pspzockersceneJDown »

Hi rednoah,
I'm pspzockerscene - JDownloader Community Manager & Supporter.
First of all thanks for the continuous work on your Synology Java-Installer - it has helped a lot of our users to setup JD more easily and we've even linked it in parts of our installation instructions.
While a lot of JD users are using your Filebot tool I admit I'm not a filebot user but nevertheless I'm here to ask a question/report a bug :D

After the update from Java-Installer 2.13 to 2.16, I noticed an issue (on DSM 6.2.4-25556):
The "JAVA_HOME" path was invalid all of the sudden.
In my case, it pointed to "/user/local/java" while the correct path seemed to be "/usr/local/bin/java".
I've checked this against uninstalling your package, installing the official Java8 package from Synology which provided a working JAVA_HOME path again.
After a reboot, I was able to start JDownloader again.
Some of our users have reported this issue in our orums too:
https://board.jdownloader.org/showthread.php?t=87688
and:
https://board.jdownloader.org/showthrea ... 99&page=59

On top of that, from what I've read the new Synology DSM7 will not provide an official/easy to install Java Package anymore so chances are high that more of our users will run into this issue soon...
I've checked your "get-java.sh" script but I wasn't able to find out any reason as why the path should be wrong with:
https://github.com/rednoah/java-install ... et-java.sh

Looking at the relevant parts of the "/etc/profile" file, this is how it looks here and it will work fine as long as "Java8" is installed via official Synology package:

Code: Select all

export JAVA_HOME=/usr/local/java    # added by Java Installer
export LANG=en_US.utf8              # added by Java Installer
PATH=$PATH:/var/packages/Java8/target/j2sdk-image/bin # Synology Java runtime enviroment
PATH=$PATH:/var/packages/Java8/target/j2sdk-image/jre/bin # Synology Java runtime enviroment
JAVA_HOME=/var/packages/Java8/target/j2sdk-image/jre # Synology Java runtime enviroment
CLASSPATH=.:/var/packages/Java8/target/j2sdk-image/jre/lib # Synology Java runtime enviroment
LANG=en_US.utf8 # Synology Java runtime enviroment
export CLASSPATH PATH JAVA_HOME LANG # Synology Java runtime enviroment
What might also be a source of error:
Neither Java-Installer nor the official Synology Java will edit the "profile" file on uninstall.

So my questions are:
Is this a Java-Installer related issue?
Aren't other Java Apps running on Synology also affected by this issue?
Is the usage of that path inside JDownloaders "vstart-stop-script" maybe problematic?

Best regards,
pspzockerscene
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Synology: Java-Installer 2.16 sets wrong JAVA_HOME path?

Post by rednoah »

/usr/local/bin/java is a symlink to the java executable file. $JAVA_HOME is the environment variable to the Java runtime folder.


:!: Note that modifying /etc/profile or creating symlinks in /usr/local is no longer possible with DSM 6.2.4 / DSM 7.0 due to the newly introduced security restrictions. If the old installer ran pre-DSM 6.2.4 then it will have modified /etc/profile but if you then ran the corresponding uninstaller on DSM 6.2.4 it will no longer have had permission to uninstall correctly.


:idea: The latest package does not modify /etc/profile because it's no longer possible. The /usr/local/bin/java link is installed by DSM as per package resource configuration.


:idea: If you rely on the java command, then it'll work, hence filebot works. If you rely on $JAVA_HOME being set correctly, then Java Installer will no longer work for you, because packages can no longer set global environment variables.
:idea: Please read the FAQ and How to Request Help.
User avatar
pspzockersceneJDown
Posts: 2
Joined: 01 Jul 2021, 12:11

Re: Synology: Java-Installer 2.16 sets wrong JAVA_HOME path?

Post by pspzockersceneJDown »

That answers all of my questions!
Thank you very much :)

Well then we'll have to either build our own Synology Package (the current one is made by one of our users) or tell our users how to modify the start script.

Best regards,
pspzockerscene
Post Reply