Installation of Java on the NAS under fun_plug

Today i’ve installed java on my NAS Device (a D-Link DNS-345) what i personally see as a highlight as i can now use software that was not available to me before. Oracle provides a “Java SE Embedded”, which is suitable for NAS devices thanks to its reduced memory footprint. For the following tutorial you need to have fun_plug installed!

Download

Go to the Oracle Page and choose “ARMv5 Linux – Headless”. Now you will be redirected to a survey, where you have to enter Name, Prename, Mail, Organization and Role. Then you will receive the download-Link via E-Mail. Click on this Link and accept the license agreement.
Java SE Embedded
Copy the downloaded file (in my case its name was ejre-7u6-fcs-b24-linux-arm-sflt-headless-10_aug_2012.tar.gz, but that is subject to change) to the NAS. I’ve copied it to /mnt/HD/HD_a2/, please adapt the following commands if you copy it elsewhere.

Installation

First create a directory:

mkdir -p /ffp/opt/java

Then unpack the archive from before:

cd /ffp/opt/java
tar xvzf /mnt/HD/HD_a2/ejre-7u6-fcs-b24-linux-arm-sflt-headless-10_aug_2012.tar.gz

Now create a link to the unpacked directory (“ejre1.7.0_06”):

ln -s ejre1.7.0_06 jre

Now put it permanently into the environment variables:

echo "export PATH=/ffp/opt/java/jre/bin:\$PATH" >> /ffp/etc/profile.d/java.sh
chmod a+x /ffp/etc/profile.d/java.sh

Logout and Login into the NAS.

Installation-test

Check if it works:

java -version

This should display something like this:

java version "1.7.0_06"
Java(TM) SE Embedded Runtime Environment (build 1.7.0_06-b24, headless)
Java HotSpot(TM) Embedded Client VM (build 23.2-b09, mixed mode)

39 thoughts on “Installation of Java on the NAS under fun_plug”

  1. Bei mir klappt die Installation bis zum Punkt java -version.
    Da erhalte ich stets die Fehlermeldung: no such file or directory

    Bitte um Hilfe.

  2. Using username “root”.
    root@192.168.123.92‘s password:
    Last login: Mon Sep 3 13:02:29 2012 from 192.168.123.100
    root@DNS-323:~# java -version
    -sh: /ffp/opt/java/jre/bin/java: No such file or directory
    root@DNS-323:~#

    Das habe ich nach einem neuerlichen Login eingegeben. Wenn ich mit cd in das Java-Verzeichnis gehe und Java direkt starte, kommt interessanterweise auch dieselbe Fehlermeldung.

    Übrigens – folgende Datei habe ich runtergeladen und installiert:
    ejre-7u6-fcs-b24-linux-arm-sflt-headless-10_aug_2012.tar.gz

    1. Hi, ich habe das gleiche Problem, wie Johannes. Trotz neuerlichem Login kein Erfolg: No such file or directory. Gibt es da einen Kniff?

  3. Thanks for this and your other tutorials they are a great resource (though finding issues using PHP on 0.7 which im currently trying to correct (going to try and compile 5.4.10))

  4. when i put this in
    cd /ffp/opt/java
    tar xfvz /mnt/HD/HD_a2/ejre-7u6-fcs-b24-linux-arm-sflt-headless-10_aug_2012.tar.gz

    i get this
    tar: old option ‘f’ requires an argument.
    try ‘tar –help’ or ‘tar –usage’ for more information

    can someone help please i am a novice noob

  5. Where should I copy the java tar.gz file in my nsa?
    How do I know what to type for the directory (instead of ‘/mnt/HD/HD_a2/’) of the tar.gz file?

    (I use NSA 310)

  6. I had a pro blem with FFP 0.7. I need to used this link commnand:
    ln -s /ffp/opt/java/ejre1.7.0_10 /ffp/opt/java/jre

  7. For those people of you, who just copied (like i did 🙂 ) :
    When creating the link you have to use the correct version number…since this manual uses “ln -s ejre1.7.0_06 jre” and you might have downloaded a newer version (like i did and i did not adhere that at first), you have to use “ln -s ejre1.7.0_21 jre”, or whatever version you downloaded. That worked for me!

    Cheers

  8. Hi,

    I have down loaded and unzipped the latest version of Java (jre1.7.0_21) on my DNS323 as per the instructions. I created a link to the ejre1.7.0_21 directory. ftp using ssh with filezilla shows the directories are there along with the “jre” link pointing to the ejre1.7.0_21 folder.

    However:

    root@DNS-STEPHEN:~# java
    -sh: java: command not found

    root@DNS-STEPHEN:~# java -version
    -sh: java: command not found

    Any ideas what’s wrong ?.

    Thanks

      1. Hello Uli,

        Yes I logged out and loginm agian. I also tried restarting the NAS – same result.

        This morning I deleted the folder ejre1.7.0_21 using rm -r.

        I then repeated the installation procedure. All the files were unzipped without errors, and all the commands executed without errors.

        To check the symbolic “jre” link is working I ran the dir commands;

        root@DNS-STEPHEN:/ffp/opt/java/jre# dir
        COPYRIGHT README THIRDPARTYLICENSEREADME.txt bin lib release

        root@DNS-STEPHEN:/ffp/opt/java/ejre1.7.0_21# dir
        COPYRIGHT README THIRDPARTYLICENSEREADME.txt bin lib release

        However;
        root@DNS-STEPHEN:~# java -version
        -sh: /ffp/opt/java/jre/bin/java: No such file or directory

        It seems “java” is not recognised.

        java.sh in the /ffp/opt/java/jre/bin/ directory has 755 permissions

        Any ideas what might be wrong ?, how do I check if the $path was correctly updated with in the environment variables ?.

        Thanks

        1. Hi stepheng,

          i think there is something else wrong.

          java is calling something which is not there, because it finds the correct java, but this is not executed.

          Can you post a

          ls -al /ffp/opt/java/jre/bin/

          Thanks 🙂

          Best Regards,
          Uli

          1. Hi Uli,

            root@DNS-STEPHEN:~# ls -al /ffp/opt/java/jre/bin/
            total 16
            drwxrwxr-x 2 10 143 4096 Apr  4 12:38 .
            drwxrwxr-x 4 10 143 4096 Apr  4 16:07 ..
            -rwxr-xr-x 1 10 143 3368 Apr  4 12:38 java
            -rwxr-xr-x 1 10 143 3468 Apr  4 12:38 keytool
          1. I presume you mean just copy the command as you typed (i.e. no sh before or start afterwards ?).

            root@DNS-STEPHEN:/ffp/opt/twonky# /ffp/opt/java/jre/bin/java
            -sh: /ffp/opt/java/jre/bin/java: No such file or directory

            It seems there is a permissions problem ?.

            Thanks again

  9. Hello. It’s great to have java in the nas! thank you!

    I can not start a cold. Jar to start ffp.
    How I can do?

    How do I start soon after starting java.sh ffp?

  10. I have a crontab / mnt/HD/HD_a2/ffp/opt/java/ejre1.7.0_21/bin/java-jar / mnt/HD/HD_a2/JARFOTO.jar but does not run!

  11. Hello ULi, Yes I’m back 🙂
    May I know whether you have any attempts or any successful installation of JDownload into DNS320 before? Thanks.

  12. hello!

    I’ve successfuly installed java on my DNS-320 with fun_plug 0.7. looks like it runs without problems.

    I’m trying to set autostart for BubbleUPnPServer [installed in /ffp/opt/bubble] with /ffp/etc/fun_plug.local but I’m failing 🙁

    when I try in the command line [after PuTTY’ing to my NAS]:

    cd /ffp/opt/bubble
    exec "java" -Djava.net.preferIPv4Stack=true -Dfile.encoding="UTF-8" -jar BubbleUPnPServer.jar $*

    everything works fine, server starts and all is good. so I’ve prepared /ffp/etc/fun_plug.local with this code:


    #!/bin/sh

    cd /ffp/opt/bubble
    exec "java" -Djava.net.preferIPv4Stack=true -Dfile.encoding="UTF-8" -jar BubbleUPnPServer.jar $*

    and I chmod +x to it. when I’m trying to execute it by sending a command:
    user@server:/ffp/etc# fun_plug.local
    i get “-sh: fun_plug.local: command not found”.

    I know that fun_plug.local is executed with bootup, but I want to test it first, to be sure, that I won’t destroy anything 😉
    what I’m doing wrong? [disclaimer: I’m not as good with linux, so it’s something like walking in the dark for me ;(]

    regards,
    piotr

  13. Hi Uli,

    I installed this version:

    ejdk-8-fcs-b132-linux-arm-sflt-03_mar_2014.tar.gz

    on a DNS-323.

    Contents of bin:
    ls -al /ffp/opt/java/jre/bin/
    drwxr-xr-x 2 10 143 4096 May 17 08:46 .
    drwxrwxr-x 5 10 143 4096 May 17 08:46 ..
    -rw-r–r– 1 10 143 498 Mar 4 04:13 jrecreate.bat
    -rw-r–r– 1 10 143 2800 Mar 4 04:13 jrecreate.config.properties
    -rwxr-xr-x 1 10 143 332 Mar 4 04:13 jrecreate.sh

    java -version
    -sh: java: not found

    I’m installing Java in hopes to run a multiplayer Minecraft server on the NAS for my kids. Any help is appreciated.

    1. I re-edited \ffp\etc\profile.d\java.sh because it appears I had missed the backslash near the end right before “$PATH” ,but now when I log back into the NAS none on my commands are working. I can’t ln, chmod, nano…

      export PATH=/ffp/opt/java/jre/bin:\$PATH

      Any ideas/help?

      1. ejdk-8u65-linux-arm-sflt.gz —instaled

        Basicly as -> bas says:
        July 8, 2014 at 19:08
        change de export in de java.sh to:

        export PATH=/ffp/opt/java/jre/linux_arm_sflt/jre/bin:$PATH

        U must change/delete the entire line in “java.sh” ->”export PATH=/ffp/opt/java/jre/bin:\$PATH”<- because wrong declaration (incomplete path+"\" before $PATH).
        Path to Java folder should be:
        "export PATH=/ffp/opt/java/jre/linux_arm_sflt/jre/bin:$PATH"

  14. change de export in de java.sh to:

    export PATH=/ffp/opt/java/jre/linux_arm_sflt/jre/bin:$PATH

  15. login as: admin
    admin@192.168.1.10‘s password:
    == Welcome at FFP version 0.7/arm, running on NSA325v2 NSA325-v2, firmware V4.71(AALS.0) ==
    admin@NSA325-v2:~$ java -Djava.awt.headless=true -jar JDownloader.jar
    -sh: java: command not found
    admin@NSA325-v2:~$ java -version
    -sh: java: command not found
    admin@NSA325-v2:~$ cd /ffp/etc/profile.d/
    admin@NSA325-v2:/ffp/etc/profile.d$ dir
    java.sh
    admin@NSA325-v2:/ffp/etc/profile.d$ login as: admin
    login: Cannot possibly work without effective root
    admin@NSA325-v2:/ffp/etc/profile.d$ admin@192.168.1.10‘s password:
    > == Welcome at FFP version 0.7/arm, running on NSA325v2 NSA325-v2, firmware V4.71(AALS.0) ==
    > admin@NSA325-v2:~$ java -Djava.awt.headless=true -jar JDownloader.jar
    > -sh: java: command not found
    > admin@NSA325-v2:~$ java -version
    > -sh: java: command not found
    > admin@NSA325-v2:~$ cd /ffp/etc/profile.d/
    > admin@NSA325-v2:/ffp/etc/profile.d$ dir
    > java.sh
    > admin@NSA325-v2:/ffp/etc/profile.d$
    >
    i cant Java Starten…

  16. Hello, wanted to install java on zyxel nsa310. Via putty I had to use “su” for installation. With normal login there was no install possible. The installation seemed to work with su, but java -version shows:
    -sh: java: command not found
    What can I do? I used ejre-7u4-fcs-b20-linux-arm-sflt-headless-12_apr_2012.tar.gz

  17. As a total newbie I successfully unpacked “ejdk1.8.0_73 ” and “jre” but “ln -s ejdk1.8.0_73 jre” gave me “ln: failed to create symbolic link `jre/ejdk1.8.0_73′: Permission denied”. Please help me. Thanks.

  18. everyone is having problems because the instruction are wrong:

    when you need to make the Permanent path this is the exact commands you should type with the proper paths

    echo "export PATH=/ffp/opt/java/jre/linux_arm_sflt/jre/bin:\$PATH" &gt;&gt; /ffp/etc/profile.d/java.sh
    chmod a+x /ffp/etc/profile.d/java.sh

Leave a Reply

Your email address will not be published. Required fields are marked *

Exit mobile version