Java SE Embedded package for Synology NAS

UPDATE 5 – Now supports DS215j and DS2015xs!
UPDATE 4 – Now supports DS414j!
UPDATE 3 – Now with Java 8, and full support for all versions on Intel CPUs running DSM 5.0!
UPDATE 2 – Now running on PowerPC 2010 Synology models running DSM 5.0 beta!
UPDATE – Now running on Armada 370/XP (ARMv7) and Intel Atom Evansport CPUs, as used in some x14 series Synology models!

There is a lot of good Java software, but it’s difficult to get Java running on a NAS. I decided to do something about that, mainly to pave the way for a Serviio package that didn’t require a huge guide to install. To stay legal, I followed how QNAP packaged Java for their NAS products. The Java binaries cannot be redistributed so this package looks for the downloaded .tar.gz archive in the public shared folder on the NAS. The end user is required to register with Oracle to get the file, as you can see from the description below. I also added locale support to the underlying Linux since Java requires this for UTF-8 support when reading from the filesystem.

Only Marvell Kirkwood, Marvell Armada 370/XP, Intel, and Freescale QorIQ/PowerQUICC PowerPC CPUs are supported, so please check which CPU your NAS has. Java 7 for Intel Atom CPU does not currently work on Synology systems running DSM versions older than 5.0, so those users are limited to Java 6. Though Oracle have published a JRE for PowerPC, it also requires DSM 5.0. PowerQUICC PowerPC synos running older DSM versions do not have a recent enough glibc version (2.3.4, but Oracle’s Java needs 2.4). It is technically possible to run Java on those units, but it requires chroot-ing to a Debian install which can get complicated. Christophe from has recently released packages to automate this.

Java package for Synology



  • If you have a multi-bay NAS, use the Shared Folder control panel to create a shared folder called public (it must be all lower case). On single bay models this is created by default. Assign it with Read/Write privileges for everyone.
  • Register with Oracle and download Java SE for Embedded 7 for either ARMv5, ARMv7 Headless Server, or PowerPC e500v2 as appropriate (Intel NAS users will need the end-of-life Java SE for Embedded 6), and save in the public shared folder. If the file isn’t found an error message will display the full expected filename. You cannot use a different version by renaming it, since the folder structure inside the archive will be different.
  • Install the Java package from the DSM Package Center. In Settings -> Package Sources add my package repository URL which is My packages will appear in the Community section once the repo URL is added.
  • If you have trouble getting the Java archive recognised, try downloading it with a different web browser. Some browsers try to help by uncompressing the file, or renaming it without warning. I have tried to code around most of these behaviours.
  • The package does not need to start, just installing it is sufficient.
  • If you update DSM later, you will need to re-install this package or else UTF-8 and locale support will be broken by the update.

Package scripts

For information, here are the package scripts so you can see what it’s going to do. You can learn more about how Synology packages work by reading the Synology Package wiki.


#--------JAVA installer script
#--------package maintained at

COMMENT="# Synology Java Package"
SYNO_CPU_ARCH="`uname -m`"
[ "`echo ${SYNO_CPU_ARCH} | cut -c1-7`" == "armv5te" ] && SYNO_CPU_ARCH="armv5tel"
[ "${SYNOPKG_DSM_ARCH}" == "armada375" ] && SYNO_CPU_ARCH="armv7l-neon"
[ "${SYNOPKG_DSM_ARCH}" == "comcerto2k" ] && SYNO_CPU_ARCH="armv7l-neon"
[ "${SYNOPKG_DSM_ARCH}" == "alpine" ] && SYNO_CPU_ARCH="armv7l-neon"
[ "${SYNO_CPU_ARCH}" == "x86_64" ] && SYNO_CPU_ARCH="i686"

if [ "${SYNOPKG_PKGNAME}" == "java6" ]; then
  if [ "`echo ${SYNO_CPU_ARCH} | cut -c1-7`" == "armv5te" ]; then
    JAVA_BUILD="ARMv5 Linux - Headless EABI"
  elif [ "${SYNO_CPU_ARCH}" == "armv7l" ]; then
    JAVA_BUILD="ARMv6/7 Linux - Headless EABI, VFP, SoftFP ABI, Little Endian"
  elif [ "${SYNO_CPU_ARCH}" == "i686" ]; then
    JAVA_BUILD="x86 Linux Small Footprint - Headless"
  elif [ "${SYNO_CPU_ARCH}" == "ppc" ]; then
    JAVA_BUILD="Power Architecture Linux - Headless - e500v2 core"

elif [ "${SYNOPKG_PKGNAME}" == "java7" ]; then
  if [ "${SYNO_CPU_ARCH}" == "armv5tel" ]; then
    JAVA_BUILD="ARMv5 Linux - Headless EABI, SoftFP ABI, Little Endian"
  elif [ "${SYNO_CPU_ARCH}" == "armv7l" ]; then
    JAVA_BUILD="ARMv6/7 Linux - Headless - Client Compiler EABI, VFP, SoftFP ABI, Little Endian"
  elif [ "${SYNO_CPU_ARCH}" == "armv7l-neon" ]; then
    JAVA_BUILD="ARMv6/7 Linux - Headless - Client Compiler EABI, VFP, HardFP ABI, Little Endian"
  elif [ "${SYNO_CPU_ARCH}" == "i686" ]; then
    JAVA_BUILD="x86 Linux Small Footprint - Headless"  
  elif [ "${SYNO_CPU_ARCH}" == "ppc" ]; then
    JAVA_BUILD="Power Architecture Linux - Headless - e500v2 with double-precision SPE Floating Point Unit"

elif [ "${SYNOPKG_PKGNAME}" == "java8" ]; then
  if [ "${SYNO_CPU_ARCH}" == "armv5tel" ]; then
    JAVA_BUILD="ARMv5/ARMv6/ARMv7 Linux - SoftFP ABI, Little Endian"
  elif [ "${SYNO_CPU_ARCH}" == "armv7l" ]; then
    JAVA_BUILD="ARMv5/ARMv6/ARMv7 Linux - SoftFP ABI, Little Endian"
  elif [ "${SYNO_CPU_ARCH}" == "armv7l-neon" ]; then
    JAVA_BUILD="ARMv6/ARMv7 Linux - VFP, HardFP ABI, Little Endian"
  elif [ "${SYNO_CPU_ARCH}" == "i686" ]; then
    JAVA_BUILD="x86 Linux Small Footprint - Headless"
  elif [ "${SYNO_CPU_ARCH}" == "ppc" ]; then
    JAVA_BUILD="Power Architecture Linux - Headless - e500v2 with double-precision SPE Floating Point Unit"

JAVA_BINARY=`echo ${JAVA_BINARY} | cut -f1 -d'.'`
PUBLIC_FOLDER="`synoshare --get public | sed -r "/Path/!d;s/^.*\[(.*)\].*$/\1/"`"
TEMP_FOLDER="`find / -maxdepth 2 -path '/volume?/@tmp' | head -n 1`"
NATIVE_BINS_FILE="`echo ${NATIVE_BINS_URL} | sed -r "s%^.*/(.*)%\1%"`"
#DSM versions older than 4.3 need locale support adding, don't download unless needed
[ ! -e /usr/bin/locale ] && INSTALL_FILES="${NATIVE_BINS_URL}"
source /etc/profile

preinst ()
  synoshare -get public > /dev/null || (
    echo "A shared folder called 'public' could not be found - note this name is case-sensitive. "
    echo "Please create this using the Shared Folder DSM Control Panel and try again."
    exit 1


  if [ -n "${JAVA_HOME}" ]; then
    echo "It seems from /etc/profile that a Java Runtime is already installed at ${JAVA_HOME}. Uninstall it and try again."
    exit 1
  [ -f ${PUBLIC_FOLDER}/${JAVA_BINARY}.tar.tar ] && JAVA_BINARY_FOUND=true
  if [ -z ${JAVA_BINARY_FOUND} ]; then
    echo "Java binary bundle not found. " > $SYNOPKG_TEMP_LOGFILE
    echo "I was expecting the file ${PUBLIC_FOLDER}/${JAVA_BINARY}.tar.gz. "
    echo "Please agree to the Oracle licence at ${DOWNLOAD_URL}, then download the '${JAVA_BUILD}' package"
    echo "and place it in the 'public' shared folder on your NAS. This download cannot be automated even if "
    echo "displaying a package EULA could potentially cover the legal aspect, because files hosted on Oracle's "
    echo "server are protected by a session cookie requiring a JavaScript enabled browser."
    exit 1

    WGET_FILENAME="`echo ${WGET_URL} | sed -r "s%^.*/(.*)%\1%"`"
    wget ${WGET_URL}
    if [[ $? != 0 ]]; then
      if [ -d ${PUBLIC_FOLDER} ] && [ -f ${PUBLIC_FOLDER}/${WGET_FILENAME} ]; then
        echo "There was a problem downloading ${WGET_FILENAME} from the official download link, "
        echo "which was \"${WGET_URL}\" "
        echo "Alternatively, you may download this file manually and place it in the 'public' shared folder. "
        exit 1
  exit 0

postinst ()
  #ldd tool is very useful but not included in DSM
  if [ ! -e /usr/local/bin/ldd ]; then
    mkdir -p /usr/local/bin
    cp ${SYNOPKG_PKGDEST}/tools/ldd-${SYNO_CPU_ARCH} /usr/local/bin/ldd

  #extract native binaries if needed
  if [ -e ${TEMP_FOLDER}/${NATIVE_BINS_FILE} ]; then
    #older DSM tar uses different command line switch for xz archives

  #extract Java (Web browsers love to interfere with .tar.gz files)
  if [ -f ${JAVA_BINARY}.tar.gz ]; then
    #Firefox seems to be the only browser that leaves it alone
    tar xzf ${JAVA_BINARY}.tar.gz
  elif [ -f ${JAVA_BINARY}.gz ]; then
    tar xzf ${JAVA_BINARY}.gz
  elif [ -f ${JAVA_BINARY}.tar ]; then
    tar xf ${JAVA_BINARY}.tar
  elif [ -f ${JAVA_BINARY}.tar.tar ]; then
    #Internet Explorer
    tar xzf ${JAVA_BINARY}.tar.tar
  #install Java
  if [ "${EXTRACTED_FOLDER}" != "${EXTRACTED_FOLDER/jdk/}" ]; then
  #change owner of folder tree
  chown -R root:root ${SYNOPKG_PKGDEST}

  echo "NOTE - This package does *not* start and stop like other packages. "
  echo "Java is correctly installed if you can see the runtime and HotSpot version numbers, "
  echo "and locale information in the package Log tab."
  exit 0

preuninst ()
  exit 0

postuninst ()
  #clean up profile mods
  sed -i "/${COMMENT}/d" /etc/profile
  sed -i "/${COMMENT}/d" /root/.profile

  #leave locale support in place on older DSM versions - too risky to delete system binaries
  exit 0


JRE_PATH="`find ${SYNOPKG_PKGDEST} -name jre`"
COMMENT="# Synology Java Package"
#set the current timezone for Java so that log timestamps are accurate, modern timezone names so DST works
SYNO_TZ=`cat /etc/synoinfo.conf | grep timezone | cut -f2 -d'"'`
SYNO_TZ=`grep "^${SYNO_TZ}" /usr/share/zoneinfo/Timezone/tzname | sed -e "s/^.*= //"`

EnvCheck ()
#updates to DSM will reset these changes so check them each startup 
  #/etc/profile should contain 5 lines added by this package tagged with trailing comments
  COUNT=`grep -c "$COMMENT$" /etc/profile`
  if [ $COUNT != 5 ]; then

    #remove any existing mods
    sed -i "/${COMMENT}/d" /etc/profile

    #add required environment variables
    echo "PATH=\$PATH:${JRE_PATH}/bin ${COMMENT}" >> /etc/profile
    echo "JAVA_HOME=${JRE_PATH} ${COMMENT}" >> /etc/profile
    echo "CLASSPATH=.:${JRE_PATH}/lib ${COMMENT}" >> /etc/profile
    echo "LANG=en_US.utf8 ${COMMENT}" >> /etc/profile
    echo "export CLASSPATH JAVA_HOME LANG PATH ${COMMENT}" >> /etc/profile

  #/root/.profile should contain 3 lines added by this package tagged with trailing comments
  COUNT=`grep -c "$COMMENT$" /root/.profile`
  if [ $COUNT != 3 ]; then

    #remove any existing mods
    sed -i "/${COMMENT}/d" /root/.profile

    #add required environment variables
    echo "PATH=\$PATH:${JRE_PATH}/bin ${COMMENT}" >> /root/.profile
    echo "TZ='${SYNO_TZ}' ${COMMENT}" >> /root/.profile
    echo "export PATH TZ ${COMMENT}" >> /root/.profile

  #timezone needs setting each startup in case system value has changed
  sed -i "s%^TZ=.* ${COMMENT}%TZ='${SYNO_TZ}' ${COMMENT}%" /root/.profile

  #DSM versions older than 4.3 need locale support adding
  if [ ! -e /usr/bin/locale ]; then

    #build missing locale with UTF-8 support (don't think it matters which language)
    cp ${SYNOPKG_PKGDEST}/bin/* /usr/bin
    cp -R ${SYNOPKG_PKGDEST}/share/i18n /usr/share
    if [ ! -d /usr/lib/locale ]; then
      mkdir /usr/lib/locale
    localedef -c -f UTF-8 -i en_US en_US.utf8

  #DSM versions up to 5.1 are missing the zoneinfo timezone definitions which causes inaccurate log timestamps
  #thanks to CoolRaoul here:
  #to revert, just remove everything apart from 'Timezone' '' from /usr/share/zoneinfo
  if [ ! -e /usr/share/zoneinfo/Europe/London ]; then
    cp -R ${SYNOPKG_PKGDEST}/zoneinfo/* /usr/share/zoneinfo/


case $1 in
    source /etc/profile
    source /root/.profile

    #evidence of whether Java can start successfully is written to the package log
    java -version > ${SYNOPKG_PKGDEST}/output.log 2>&1
    echo >> ${SYNOPKG_PKGDEST}/output.log
    echo System installed locales: >> ${SYNOPKG_PKGDEST}/output.log
    locale -a >> ${SYNOPKG_PKGDEST}/output.log
    echo >> ${SYNOPKG_PKGDEST}/output.log
    echo JAVA_HOME=$JAVA_HOME >> ${SYNOPKG_PKGDEST}/output.log
    echo TZ=$TZ >> ${SYNOPKG_PKGDEST}/output.log

    exit 0

    exit 0

    source /etc/profile
    source /root/.profile
    if [ -e "${JAVA_HOME}/bin/java" ]; then
      exit 0
      exit 1

    echo "${SYNOPKG_PKGDEST}/output.log"
    exit 0



  • 0031 Fixed issue with version 0030 for systems with more than one volume
  • 0030 Improved temp folder detection, updated to Java 7u75 and Java 8u33 (Oracle did not publish a version for PowerPC
  • 0029 DSM timezone file is no longer overwritten, which had been prompting a malware alert in DSM 5.1 Security Advisor
  • 0028 Updated to Java 7u71, added missing zoneinfo timezone definitions to fix inaccurate timestamps for non-GMT timezones (checked every startup), switched native binary archives from .tgz to .tar.xz format to reduce size
  • 0027 Updated Java 8 to 8u6, added support for Mindspeed Comcerto 2000 CPU in DS414j for Java 7 and Java 8
  • 0026 DSM updates will no longer break Java
  • 0025 Updated to Java 7u60
  • 0024 Updated to Java 7u55
  • 0023 Added Java 8 support
  • 0022 Updated to Java 7u51
  • 0021 Locale support is no longer downloaded and added to DSM 4.3 or newer since it’s already present
  • 0020 Added support for Intel Atom Evansport and Armada XP CPUs in new DSx14 products, removed Early Access JDK 8 support since it did not run on the Armada SoCs
  • 0019 Updated to Java 7u45
  • 0018 Updated to Java 7u40, and JDK8 Early Access b106
  • 0017 For Armada370 CPU changed from ARMv7 Server JVM to Client JVM since the Server one turned out to be unstable. Added support for Early Access JDK 8 for Armada 370.
  • 0016 Added Armada370 CPU support (DS213j)
  • 0015 Updated to Java 7u21, Java 6 Embedded seems to be no longer maintained by Oracle
  • 0014 Fixed metadata for DSM 4.2 Package Center
  • 013 Updated to Java 6u38 and Java 7u10
  • 012 Installer script fetches native binaries separately to reduce bandwidth on repo hosting
  • 011 Added support for Freescale QorIQ PowerPC CPUs used in some Synology x13 series products, PowerQUICC PowerPC processors in previous Synology generations with older glibc versions are not supported
  • 010 updated to Java 6u34 and Java 7u6
  • 009 corrected timezone bug for Atlantic and Pacific timezones which may have caused error messages when in fact the package had installed correctly
  • 008 unified the build scripts
  • 007 included the locale binaries to simplify installation, fixed environment variables for root user (inc. timezone with DST support), displayed Java version information and env vars in Log tab, incremented Java to latest versions 6u32 and 7u4, fixed detection of renamed .tar.gz archives downloaded by Google Chrome
  • 006 fixed path issue for root user on non-bootstrapped systems, updated info link to refer back to this page, and improved description text
  • 005 incremented JRE versions to match new releases from Oracle
  • 004 forced check for existence of ‘public’ shared folder
  • 003 fixed a stupid typo that stopped 002 from working :)
  • 002 rewrote scripts to be easier to maintain, and to allow for web browsers that untar or rename the Java and toolchain binary bundles as they’re saved
  • 001 fixed package repo support, defined as a non-runnable service, prevented more than one JRE being installed, saved files into actual package folder rather than @appstore/java now that package names can be separate from Package Center display names
  • v3 initial spk release (I think!)
About these ads

928 thoughts on “Java SE Embedded package for Synology NAS

  1. Tim

    Trying to get this running on a Synology 212j with DSM 5.1. My public folder is empty, I’ve added the repo, and when I attempt to install Java SE Embedded 7 I just get the error message “Failed to install “Java SE Embedded 7.” But no other info like which package I should upload to the public folder. I’ve tried all the current ARM headless packages and nothing seems to be working. Any thoughts? Is it because of DSM 5.1?

      1. patters Post author

        The CrashPlan and Java packages are now signed by Synology with my key, and my repo is currently pushing this key (see it in Certificates tab of Package Center Settings). So once all my packages have been signed I advise you set the trust level to “Synology Inc. and Trusted Publishers”.

  2. don

    hi Patters
    so pb starting to try the install of java 6 for a Ds415+ (intel atom)…
    1) using DSM 5.1-5022 Update 2
    2) activation of “service d’accueil utisisateur” in user menu – advanced (should be the user home service)
    3) creation of public folder (admin user has all access)
    4) download of jre 6 for intel, name same as in your script ejre-1_6_0_38-fcs-b05-linux-i586-headless-13_nov_2012.tar.gz
    5) adding your url for custom packets downloads
    6) click on java6 icon for install
    it recognize the package, but when i click apply, i have the error: “echec de l’installation de java se embedded 6″
    Do you have an idea or am I doing wrong somewhere?

  3. don

    ok consider i solved my java installation pb :)
    now facing a pb of error loading serviio console: error
    i put my nas ip into the vmoptions file, could see the homepage by hitting the mediabrowser directly on the nas
    trying the console version instead last one 1.5
    edit during post reply: ok with :)
    so consider forget me!

  4. Pingback: JIRA Installation on Synolgy NAS – Part 1 – Introduction | Evan Laske

  5. KipiK

    Hello Patters,
    Thank you for this superpackage, it saves my life on a daily basis ! Just one question: do you advise to go to java 8 instead of 7, appart from the security point of view, is java 8 less hungry in terms of memory ?

  6. Rick Denatale


    I’m having problems installing the Java 8 version of the package.

    I can’t seem to find the right oracle download. I’ve tried several and keep getting told that the file format is invalid when I try to install the package.

    Also I was wondering if it’s possible to install Java 8 and still have Java 7 installed via the Synology Java Manager, since I think some other packages (Crashplan for example) don’t like Java 8. I’m trying to run both Crashplan and filebot.

  7. Allan Clearwaters

    Hi – I am attempting to install on a DS415play running 5.01. I download and put into the public directory ejre-7u75-fcs-b13-linux-i586-headless-18_dec_2014.tar.gz but it is not recognized. I’ve followed the instuctions to the letter – where else might I look. Its the same for a JRE6 or 7 installation. Thanx — Al

  8. edgar

    Thnx for putting this up, I used it to install a minecraft server for my nephew. One question though: How can I start Java8 from the taskmanager on the Synolgy NAS eg create a task to launch java and the server.jar

  9. Robert Heuser


    I am using DSM 4.2 on a Synology DS 209 II, but I am unable to see the Java packaghes when I add them to the package center. I would like to install them for a Minecraft server for my son. Can you give me advise?

  10. Ben

    thank you for your work.
    Sadly i am not successful in installing Java.

    I tried to install either Java SE Embedded 7 or 8 on my DS215j. After installation the protocol says “ line 28: java: not found”

    Installing further packages end in the error “Java_Home not defined”

    Do you have any suggestion how to solve this problem?

    Thanks a lot,

  11. Olivier

    Hi there,

    I read in your explanation that “I also added locale support to the underlying Linux since Java requires this for UTF-8 support when reading from the filesystem.”.
    Could you be more specific on this ? (howto :-p )

    I actually am struggling with a crashplan install on a freeNas. Crashplan works but it has problem with non POSIX character sets (it actually ignores accentuated filenames). After some long research i believe the problem comes from the java itself (running on some linux compatibility layer) and stumbled on this post.

    For the moment the java version used is linux-sun-jre1.7.0

    Tx !

  12. Simon

    Hi there. Want to say thanks for your work on this package. Happily restoring from backup of a dead computer to my new NAS.

  13. John Davis

    I am also trying to install on DSM 4.2 on a DS 509+. I added your repo, but only see craftbukkit, minecraft and openremote packages–no crashplan or java. Can you help me?

  14. g8r87trp92

    I updated to DSM 5.2 today and cannot get CrashPlan to run. Usually this is resolved by reinstalling Java 8 and the CrashPlan package. However, this time no luck. It appears that CrashPlan starts, but then attempts (unsuccessfully) to download and install an upgrade, then comes to a complete halt. Log screenshot (or link to image) is below. Any suggestions for resolving this?

  15. Kevin

    I’m having the same problem. My DS1513 updated to the latest DSM today and now Crash Plan won’t stay running. I’ve reinstall Java 7u75 and Crashplan but no luck. Any ideas?

  16. Steve Reynolds

    So there is no way to get java 7+ on my DS 412+???? From your updates it seems as if I can have Java 8 on my DS412 intel processor. Or am I still limited because of my NAS

  17. Vincent Ferreux

    Hi Patters,

    Since DSM5.2, I think there is a timezone TZ problem, applications running with Java are 2 hours late (Openhab, here in France)
    It seems it comes from there in :

    SYNO_TZ=`grep “^${SYNO_TZ}” /usr/share/zoneinfo/Timezone/tzname | sed -e “s/^.*= //”`

    tzname doesn’t exist anymore, replaced by tzlist.

    Possible ?

    Thanks for the good job,




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s