Java SE Embedded package for Synology NAS

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. In compliance with the Oracle EULA 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 (DSM 4.3 later included this). Timezone support is also configured.

This package installs Java SE Embedded which is purposefully designed to run on low specification headless hardware. It should be noted that Synology Java Manager (only available on Intel products) is the full Java Runtime Environment, and consequently uses more RAM. By default you should use Java 8, unless the application you want to run specifically requires Java 7.

Please note that Oracle ceased maintaining Java 6 in 2012, so it should be considered a serious security vulnerability. The Java 6 package has been withdrawn from the package repository for this reason. If you need it to run a particular piece of software you may download it here for manual installation. Please also note that Oracle retired support for PowerPC CPUs following Java 8 Update 6, so the PowerPC package remains at that version.

Java Package

 

Instructions

  • In Synology DSM’s Package Center, click Settings and add my package repository:
    Add Package Repository
  • The repository will push its certificate automatically to the NAS, which is used to validate package integrity. Set the Trust Level to Synology Inc. and trusted publishers:
    Trust Level
  • Now browse the Community section in Package Center to install a Java SE Embedded package:
    Community-packages
    The repository only displays packages which are compatible with your specific model of NAS. If you don’t see Java Embedded in the list, then either your NAS model or your DSM version are not supported at this time.
  • 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 the appropriate version of Java SE Embedded for your CPU architecture and save in the public shared folder on your NAS. Note that to get any version of Java older than the current one you will need to follow the Oracle Java SE Embedded Downloads Archive link on that page. If in doubt, attempt to install the package first, and the error message will tell you which specific download version is required.
  • 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. Use Firefox if all else fails.
 

Package scripts

For information, here are the package scripts so you can see what it’s going to do. You can get more information about how packages work by reading the Synology 3rd Party Developer Guide.

installer.sh

#!/bin/sh

#--------JAVA installer script
#--------package maintained at pcloadletter.co.uk

COMMENT="# Synology Java Package"
SYNO_CPU_ARCH="`uname -m`"
[ "`echo ${SYNO_CPU_ARCH} | cut -c1-7`" == "armv5te" ] && SYNO_CPU_ARCH="armv5tel"
#--------Synology switched Armada 370 systems from SoftFP to HardFP EABI for DSM 6.0
[ "${SYNOPKG_DSM_ARCH}" == "armada370" ] && [ ${SYNOPKG_DSM_VERSION_MAJOR} -gt 5 ] && SYNO_CPU_ARCH="armv7l-hflt"
[ "${SYNOPKG_DSM_ARCH}" == "armada375" ] && SYNO_CPU_ARCH="armv7l-hflt"
[ "${SYNOPKG_DSM_ARCH}" == "armada38x" ] && SYNO_CPU_ARCH="armv7l-hflt"
[ "${SYNOPKG_DSM_ARCH}" == "comcerto2k" ] && SYNO_CPU_ARCH="armv7l-hflt"
[ "${SYNOPKG_DSM_ARCH}" == "alpine" ] && SYNO_CPU_ARCH="armv7l-hflt"
[ "${SYNOPKG_DSM_ARCH}" == "alpine4k" ] && SYNO_CPU_ARCH="armv7l-hflt"
[ "${SYNOPKG_DSM_ARCH}" == "monaco" ] && SYNO_CPU_ARCH="armv7l-hflt"
[ "${SYNOPKG_DSM_ARCH}" == "x86_64" ] && [ "${WIZARD_JRE_EE}" == "true" ] && SYNO_CPU_ARCH="i686"
[ "${SYNOPKG_DSM_ARCH}" == "x86_64" ] && [ ${SYNOPKG_DSM_VERSION_MAJOR} -lt 6 ] && SYNO_CPU_ARCH="i686"

if [ "${SYNOPKG_PKGNAME}" == "java6" ]; then
  DOWNLOAD_URL="http://tinyurl.com/javaembedarchive"
  EXTRACTED_FOLDER="ejre1.6.0_38"
  JCE_BINARY="jce_policy-6.zip"
  JCE_URL="http://tinyurl.com/java-jce6"
  JCE_FOLDER="jce"
  if [ "`echo ${SYNO_CPU_ARCH} | cut -c1-7`" == "armv5te" ]; then
    JAVA_BINARY="ejre-1_6_0_38-fcs-b05-linux-arm-sflt-eabi-headless-13_nov_2012.tar.gz"
    JAVA_BUILD="ARMv5 Linux - Headless EABI"
  elif [ "${SYNO_CPU_ARCH}" == "armv7l" ]; then
    JAVA_BINARY="ejre-1_6_0_38-fcs-b05-linux-arm-vfp-eabi-headless-13_nov_2012.tar.gz"
    JAVA_BUILD="ARMv6/7 Linux - Headless EABI, VFP, SoftFP ABI, Little Endian"
  elif [ "${SYNO_CPU_ARCH}" == "i686" ]; then
    JAVA_BINARY="ejre-1_6_0_38-fcs-b05-linux-i586-headless-13_nov_2012.tar.gz"
    JAVA_BUILD="x86 Linux Small Footprint - Headless"
  elif [ "${SYNO_CPU_ARCH}" == "x86_64" ]; then
    JAVA_BINARY="ejre-1_6_0_38-fcs-b05-linux-i586-headless-13_nov_2012.tar.gz"
    JAVA_BUILD="x86 Linux Small Footprint - Headless"
  elif [ "${SYNO_CPU_ARCH}" == "ppc" ]; then
    JAVA_BINARY="ejre-1_6_0_38-fcs-b05-linux-ppc-e500v2-headless-13_nov_2012.tar.gz"
    JAVA_BUILD="Power Architecture Linux - Headless - e500v2 core"
  fi    

elif [ "${SYNOPKG_PKGNAME}" == "java7" ]; then
  DOWNLOAD_URL="http://tinyurl.com/javaembed"
  EXTRACTED_FOLDER="ejre1.7.0_75"
  JCE_BINARY="UnlimitedJCEPolicyJDK7.zip"
  JCE_URL="http://tinyurl.com/java-jce7"
  JCE_FOLDER="UnlimitedJCEPolicy"
  if [ "${SYNO_CPU_ARCH}" == "armv5tel" ]; then
    JAVA_BINARY="ejre-7u75-fcs-b13-linux-arm-sflt-headless-18_dec_2014.tar.gz"
    JAVA_BUILD="ARMv5 Linux - Headless EABI, SoftFP ABI, Little Endian"
  elif [ "${SYNO_CPU_ARCH}" == "armv7l" ]; then
    JAVA_BINARY="ejre-7u75-fcs-b13-linux-arm-vfp-sflt-client_headless-18_dec_2014.tar.gz"
    JAVA_BUILD="ARMv6/7 Linux - Headless - Client Compiler EABI, VFP, SoftFP ABI, Little Endian"
  elif [ "${SYNO_CPU_ARCH}" == "armv7l-hflt" ]; then
    JAVA_BINARY="ejre-7u75-fcs-b13-linux-arm-vfp-hflt-client_headless-18_dec_2014.tar.gz"
    JAVA_BUILD="ARMv6/7 Linux - Headless - Client Compiler EABI, VFP, HardFP ABI, Little Endian"
  elif [ "${SYNO_CPU_ARCH}" == "i686" ]; then
    JAVA_BINARY="ejre-7u75-fcs-b13-linux-i586-headless-18_dec_2014.tar.gz"
    JAVA_BUILD="x86 Linux Small Footprint - Headless"  
  elif [ "${SYNO_CPU_ARCH}" == "x86_64" ]; then
    JAVA_BINARY="ejre-7u75-fcs-b13-linux-i586-headless-18_dec_2014.tar.gz"
    JAVA_BUILD="x86 Linux Small Footprint - Headless"  
  elif [ "${SYNO_CPU_ARCH}" == "ppc" ]; then
    JAVA_BINARY="ejre-7u75-fcs-b13-linux-ppc-e500v2-headless-18_dec_2014.tar.gz"
    JAVA_BUILD="Power Architecture Linux - Headless - e500v2 with double-precision SPE Floating Point Unit"
  fi

elif [ "${SYNOPKG_PKGNAME}" == "java8" ]; then
  DOWNLOAD_URL="http://tinyurl.com/javaembed"
  EXTRACTED_FOLDER="ejdk1.8.0_211"
  JCE_BINARY="jce_policy-8.zip"
  JCE_URL="http://tinyurl.com/java-jce8"
  JCE_FOLDER="UnlimitedJCEPolicyJDK8"
  if [ "${SYNO_CPU_ARCH}" == "armv5tel" ]; then
    JAVA_BINARY="ejdk-8u211-linux-arm-sflt.tar.gz"
    JAVA_BUILD="ARMv5/ARMv6/ARMv7 Linux - SoftFP ABI, Little Endian 2"
  elif [ "${SYNO_CPU_ARCH}" == "armv7l" ]; then
    JAVA_BINARY="ejdk-8u211-linux-arm-sflt.tar.gz"
    JAVA_BUILD="ARMv5/ARMv6/ARMv7 Linux - SoftFP ABI, Little Endian 2"
  elif [ "${SYNO_CPU_ARCH}" == "armv7l-hflt" ]; then
    JAVA_BINARY="ejdk-8u211-linux-armv6-vfp-hflt.tar.gz"
    JAVA_BUILD="ARMv6/ARMv7 Linux - VFP, HardFP ABI, Little Endian 1"
  elif [ "${SYNO_CPU_ARCH}" == "aarch64" ]; then
    JAVA_BINARY="jdk-8u211-linux-arm64-vfp-hflt.tar.gz"
    JAVA_BUILD="Linux ARM 64 Hard Float ABI"
    DOWNLOAD_URL="http://tinyurl.com/java8arm64"
    EXTRACTED_FOLDER="jdk1.8.0_211"
  elif [ "${SYNO_CPU_ARCH}" == "i686" ]; then
    JAVA_BINARY="ejdk-8u211-linux-i586.tar.gz"
    JAVA_BUILD="x86 Linux Small Footprint - Headless"
  elif [ "${SYNO_CPU_ARCH}" == "x86_64" ]; then
    JAVA_BINARY="jre-8u211-linux-x64.tar.gz"
    JAVA_BUILD="Linux x64"
    EXTRACTED_FOLDER="jre1.8.0_211"
    DOWNLOAD_URL="http://tinyurl.com/java8x64"
  elif [ "${SYNO_CPU_ARCH}" == "ppc" ]; then
    #Oracle have discontinued Java 8 for PowerPC after update 6
    JAVA_BINARY="ejdk-8u6-fcs-b23-linux-ppc-e500v2-12_jun_2014.tar.gz"
    JAVA_BUILD="Power Architecture Linux - Headless - e500v2 with double-precision SPE Floating Point Unit"
    EXTRACTED_FOLDER="ejdk1.8.0_06"
  fi
fi

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_URL="http://packages.pcloadletter.co.uk/downloads/java-native-${SYNO_CPU_ARCH}.tar.xz"
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. " >> $SYNOPKG_TEMP_LOGFILE
    echo "Please create this using the Shared Folder DSM Control Panel and try again." >> $SYNOPKG_TEMP_LOGFILE
    exit 1
  )

  JAVA_BINARY_FOUND=

  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." >> $SYNOPKG_TEMP_LOGFILE
    exit 1
  fi
  
  [ -f ${PUBLIC_FOLDER}/${JAVA_BINARY}.tar.gz ] && JAVA_BINARY_FOUND=true
  [ -f ${PUBLIC_FOLDER}/${JAVA_BINARY}.tar ] && JAVA_BINARY_FOUND=true
  [ -f ${PUBLIC_FOLDER}/${JAVA_BINARY}.tar.tar ] && JAVA_BINARY_FOUND=true
  [ -f ${PUBLIC_FOLDER}/${JAVA_BINARY}.gz ] && 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. " >> $SYNOPKG_TEMP_LOGFILE
    echo "Please agree to the Oracle licence at ${DOWNLOAD_URL}, then download the '${JAVA_BUILD}' package" >> $SYNOPKG_TEMP_LOGFILE
    echo "and place it in the 'public' shared folder on your NAS. This download cannot be automated even if " >> $SYNOPKG_TEMP_LOGFILE
    echo "displaying a package EULA could potentially cover the legal aspect, because files hosted on Oracle's " >> $SYNOPKG_TEMP_LOGFILE
    echo "server are protected by a session cookie requiring a JavaScript enabled browser." >> $SYNOPKG_TEMP_LOGFILE
    exit 1
  fi

  if [ "${WIZARD_JCE_UL}" == "true" ]; then
    if [ ! -f ${PUBLIC_FOLDER}/${JCE_BINARY} ]; then
      echo "JCE Unlimited Strength binary bundle not found. " >> $SYNOPKG_TEMP_LOGFILE
      echo "I was expecting the file ${PUBLIC_FOLDER}/${JCE_BINARY} " >> $SYNOPKG_TEMP_LOGFILE
      echo "Please agree to the Oracle licence at ${JCE_URL}, then download the Unlimited Strength Jurisdiction Policy Files zip file " >> $SYNOPKG_TEMP_LOGFILE
      echo "and place it in the 'public' shared folder on your NAS. " >> $SYNOPKG_TEMP_LOGFILE
      exit 1
    fi    
  fi    

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


postinst ()
{
  WORKING_DIR=`pwd`
  
  #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
  fi

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

  #extract Java (Web browsers love to interfere with .tar.gz files)
  cd ${PUBLIC_FOLDER}
  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
    #Chrome
    tar xzf ${JAVA_BINARY}.gz
  elif [ -f ${JAVA_BINARY}.tar ]; then
    #Safari
    tar xf ${JAVA_BINARY}.tar
  elif [ -f ${JAVA_BINARY}.tar.tar ]; then
    #Internet Explorer
    tar xzf ${JAVA_BINARY}.tar.tar
  fi

  #install Java
  if [ "${EXTRACTED_FOLDER}" != "${EXTRACTED_FOLDER/jdk/}" ]; then
    mv ${EXTRACTED_FOLDER} ${SYNOPKG_PKGDEST}
    JRE_PATH="`find ${SYNOPKG_PKGDEST}/${EXTRACTED_FOLDER} -name jre`"
  else
    mv ${EXTRACTED_FOLDER} ${SYNOPKG_PKGDEST}/jre
    JRE_PATH="${SYNOPKG_PKGDEST}/jre"
  fi

  #install unlimited crypto policy files if requested
  if [ "${WIZARD_JCE_UL}" == "true" ]; then
    if [ -e /usr/bin/7z ]; then
      7z x ${JCE_BINARY} > /dev/null 2>&1
    else
      unzip ${JCE_BINARY} 
    fi
    mv ${JCE_FOLDER}/* ${JRE_PATH}/lib/security
    rmdir ${JCE_FOLDER}
  fi  

  #change owner of folder tree
  chown -R root:root ${SYNOPKG_PKGDEST}

  echo "NOTE - This package does *not* start and stop like other packages. " >> $SYNOPKG_TEMP_LOGFILE
  echo "Java is correctly installed if you can see the runtime and HotSpot version numbers, " >> $SYNOPKG_TEMP_LOGFILE
  echo "and locale information in the package Log tab." >> $SYNOPKG_TEMP_LOGFILE
  
  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
}
 

start-stop-status.sh

#!/bin/sh

JRE_PATH="`find /var/packages/${SYNOPKG_PKGNAME}/target/ -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'"'`
#fix for DST time in DSM 5.2 thanks to MinimServer Syno package author
[ -e /usr/share/zoneinfo/Timezone/synotztable.json ] \
 && SYNO_TZ=`jq ".${SYNO_TZ} | .nameInTZDB" /usr/share/zoneinfo/Timezone/synotztable.json | sed -e "s/\"//g"` \
 || 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
  fi

  #/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
  fi

  #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
    fi
    localedef -c -f UTF-8 -i en_US en_US.utf8
  fi

  #DSM versions up to 5.1 are missing the zoneinfo timezone definitions which causes inaccurate log timestamps
  #thanks to CoolRaoul here: http://forum.synology.com/enu/viewtopic.php?f=19&t=69232#p310553
  #to revert, just remove everything apart from 'Timezone' 'zone.tab' from /usr/share/zoneinfo
  if [ ! -e /usr/share/zoneinfo/Europe/London ]; then
    cp -R ${SYNOPKG_PKGDEST}/zoneinfo/* /usr/share/zoneinfo/
  fi

}

case $1 in
  start)
    EnvCheck
    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
  ;;

  stop)
    exit 0
  ;;

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

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

esac
 

install_uifile

[
  {
    "step_title": "Java Runtime Environment Selection",
    "items": [
      {
        "type": "singleselect",
        "desc": "Please select the Java version to install:",
        "subitems": [
          {
            "key": "WIZARD_JRE_EE",
            "desc": "Java SE Embedded 8 (smaller memory footprint, 32bit)",
            "defaultValue": true
          },
          {
            "key": "WIZARD_JRE_SE",
            "desc": "Java SE 8 (64bit)",
            "defaultValue": false
          }
        ]
      }
    ]
  },
  {
    "step_title": "Java Cryptography Strength Selection",
    "items": [
      {
        "type": "singleselect",
        "desc": "Please select Java Cryptographic Extension policy:",
        "subitems": [
          {
            "key": "WIZARD_JCE_STD",
            "desc": "Default Strong JCE policy - limited to AES-128 encryption",
            "defaultValue": true
          },
          {
            "key": "WIZARD_JCE_UL",
            "desc": "Unlimited Strength JCE policy - not permitted in some jurisdictions, see Oracle documentation",
            "defaultValue": false
          }
        ]
      }
    ]
  }
]
 

Changelog:

  • 0050 17/Apr/19 – Updated to Java 8u211, added support for DS119j
  • 0049 11/Apr/19 – Updated to Java 8u201, fixed issue where x86_64 CPUs would ignore user selection and always install 64bit Java SE
  • 0048 22/Aug/18 – Updated to Java 8u181, added option to select 64bit full Java SE for x86_64 CPUs
  • 0047 14/May/18 – Updated to Java 8u171
  • 0046 20/Feb/18 – Updated to Java 8u161, experimental aarch64 support
  • 0045 30/Oct/17 – Updated to Java 8u151, added support for new CPUs in x17 and x18 models
  • 0044 02/Aug/17 – Updated to Java 8u144
  • 0043 21/Jan/17 – Updated to Java 8u121
  • 0042 07/Jan/17 – Updated to Java 8u111, fixed Armada 370/XP systems running DSM 6.0 which had switched from soft to hard float ABI
  • 0041 25/Jul/16 – Added support for unlimited strength cryptography (default is strong)
  • 0040 20/Jul/16 – Updated to Java 8u101
  • 0039 26/Apr/16 – Updated to Java 8u91
  • 0038 24/Mar/16 – Updated to Java 8u77
  • 0037 07/Feb/16 – Updated to Java 8u73
  • 0036 26/Jan/16 – Updated to Java 8u71
  • 0035 14/Dec/15 – Updated to Java 8u65, added support for models DS716+ and DS216play
  • 0034 19/Aug/15 – Fixed timezone DST issue with DSM 5.2, added support for DS215+
  • 0033 07/Aug/15 – Updated to Java 8u51, PowerPC build remains at 8u6
  • 0032 13/Jul/15 – Fixed timezone issue with DSM 5.2, updated main blog post documentation
  • 0031 25/Jan/15 – Fixed issue with version 0030 for systems with more than one volume
  • 0030 21/Jan/15 – Improved temp folder detection, updated to Java 7u75 and Java 8u33 (Oracle did not publish a version for PowerPC)
  • 0029 25/Dec/14 – DSM timezone zone.tab file is no longer overwritten, which had been prompting a malware alert in DSM 5.1 Security Advisor
  • 0028 20/Oct/14 – 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 18/Oct/14 – Updated Java 8 to 8u6, added support for Mindspeed Comcerto 2000 CPU in DS414j for Java 7 and Java 8
  • 0026 24/Jun/14 – DSM updates will no longer break Java
  • 0025 31/May/14 – Updated to Java 7u60
  • 0024 31/May/14 – Updated to Java 7u55
  • 0023 27/May/14 – Added Java 8 support
  • 0022 30/Jan/14 – Updated to Java 7u51
  • 0021 15/Nov/13 – Locale support is no longer downloaded and added to DSM 4.3 or newer since it’s already present
  • 0020 30/Oct/13 – 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 17/Oct/13 – Updated to Java 7u45
  • 0018 11/Oct/13 – Updated to Java 7u40, and JDK8 Early Access b106
  • 0017 05/Jun/13 – 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 21/May/13 – Added Armada370 CPU support (DS213j)
  • 0015 18/Apr/13 – Updated to Java 7u21, Java 6 Embedded seems to be no longer maintained by Oracle
  • 0014 13/Feb/13 – Fixed metadata for DSM 4.2 Package Center
  • 013 13/Dec/12 – Updated to Java 6u38 and Java 7u10
  • 012 10/Dec/12 – 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 23/Aug/11 – 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!)
 
 

1,229 thoughts on “Java SE Embedded package for Synology NAS

  1. Strongberry's avatarStrongberry

    Hello!

    I installed the java 6 version package from the admin account. It works fine but how do I get the root user to use java?

    Any ideas?

    Reply
  2. Sid Gadkari's avatarSid Gadkari

    Having issues with Serviio on my DS210j with Java 7…

    Everything installs fine but when I open Serviio it says:

    Cannot connect to Serviio server, it does not seem to be running. Exiting…
    Rest error to “profiles” : Service Unavailable (503)
    Rest error to “browsingCategoriesLanguages” : Service Unavailable (503)
    Rest error to “onlineContentQualities” : Service Unavailable (503)
    Rest error to “metadataLanguages” : Service Unavailable (503)
    Rest error to “descriptiveMetadataExtractors” : Service Unavailable (503)
    Rest error to “categoryVisibilityTypes” : Service Unavailable (503)
    Rest error to “cpu-cores” : Service Unavailable (503)
    Rest error to “onlineRepositoryTypes” : Service Unavailable (503)
    Rest error to “status” : Service Unavailable (503)

    If I try to navigate through the tabs in the UI it just adds more lines the error above. What’s the deal?

    Reply
      1. patters's avatarpatters Post author

        That looks normal – have you tried to connect with the Serviio Remote Console from another computer? (details in the Serviio FAQ on the website)
        Are you sure you’re not trying to connect too soon? Serviio takes a couple of minutes to start fully.

      2. Sid's avatarSid

        Serviio UI worked from a different browser.

        Now the only issue is accessing Serviio from my Xbox 360 — I see it as a video media source but there’s no files listed. Does Serviio need a while to cache all the info?

  3. eagle's avatareagle

    Hi,

    I am looking really hard but I couldn’t find the Java package in package center from your package repository. Is it taken down?

    Thanks.

    Reply
    1. patters's avatarpatters Post author

      No, it’s definitely there. The repo only displays the packages that will work on you particular model of syno. Is your NAS CPU one of the supported types?

      Reply
      1. eagle's avatareagle

        Yes, I can see 6: CraftBukkit, CrashPlan, Minecraft, OpenRemote, Serviio and Subsonic. I didn’t confirm what CPU I have, but it should be what the wiki says. I didn’t hack the system either, as I am not that techie to do such thing.

      2. patters's avatarpatters Post author

        WordPress shows me the IP you posted the comment from, and I checked this against my package repo logs. I see your syno’s requests and everything looks fine. However, I noticed you’re on DSM 3.2 build 1922 which has a stupid bug in the Package Center that prevents it showing scroll bars in the main window. If you maximize the window you’ll see the Java packages! They fixed that in DSM 3.2-1955. I have updated the Instructions section.

  4. eagle's avatareagle

    Hi,

    I updated DSM to 3.2-1955 and tried to install Java SE for Embedded 6. However, once I click install, I would get an error message “Failed to download” almost instantly. I am using DS411j and I have these two files in my public folder:

    1. ejre-1_6_0_30-fcs-b12-linux-arm-sflt-eabi-headless-10_nov_2011.tar.gz
    2. gcc421_glibc25_88f628x.tgz

    Do you know why could cause the error?

    Thanks.

    Reply
    1. eagle's avatareagle

      I also get “Java SE for embedded 6: broken” shows up temporarily before “Failed to download” pops up. I notice someone had the same problem but he decided to install Java 7. However, if I read your post correctly, Java 7 will not work on the CPU I have?

      Thanks.

      Reply
  5. Novate's avatarNovate

    Hi, I tried installing Java 6 spk on Synology 4.0 Beta (running DS 710+), but keep getting the error: “Failed to install package”. I don’t believe its the problem mentioned before with the tarballs being converted when uploaded.

    When installing, I did the following>
    1) I updated the package sources in Package Center to include: http://pcloadletter.comlu.com
    2) Updated, and then choose the tab “Other Sources” and then choose ‘Install” for the Java 6 package.
    3) It downloads the spk, and then untars the tarballs to a folder (x86_64-linux-gnu) in the public folder.
    4) After a bit installation stops with the error message: “Failed to install package” in its own dialog.

    Can anyone help me figure out what has gone wrong. I’ve uninstalled the package and retried several times, but get the same error. I’ve looked on the x86_64-linux-gnu folder for a log file, but didn’t find one.

    Not sure what to do, and would really like to get Subsonic going on this NAS…

    Reply
    1. Novate's avatarNovate

      I know DSM 4.0 is currently in Beta, but it probably won’t be more than a few months before it gets officially released

      Reply
      1. patters's avatarpatters Post author

        All the packages work fine on DSM 4.0 beta. You’re definitely downloading the DSM 3.1 toolchain as required, yes? Don’t try using a different one and renaming the file – it won’t work.

      2. Novate's avatarNovate

        It appears some 4.0 beta users have successfully installed. Not sure why I get an error…

        Is it possible using the 3.2 toolchain could help (or that we just have to wait for a 4.0 toolchain to be GPLed by Synology)?

        Are there any files in the x86_64-linux-gnu folder (or commands vis SSH) I can use to help debug?

      3. patters's avatarpatters Post author

        Don’t use the 3.2 toolchain. I don’t know how much more explicit I can be. It only uses the locale and localedef binaries from it, and if you look at the version numbers you can see that the GCC and glibc versions are exactly the same. However, the archive is laid out differently so my script won’t find the files in the 3.2 toolchain.

      4. Novate's avatarNovate

        Hi Patters, It looks like we got off on the wrong foot.

        Thanks for taking time to reply.

        I haven’t used the 3.2 tool chain. I downloaded the 3.1 toolchain using the link in your instructions:

        I my mention of the 3.2 toolchain (obvious to me now that is barking up the wrong tree) got posted before I saw your reply. I was just trying to think of alternatives to try since I couldn’t get the package to install, and do not know how to debug the problem (sorry – somewhat of a n00b wrt modding my NAS).

        I’ll do whatever I can to help debug the problem, just let me know where to start.

      5. patters's avatarpatters Post author

        The folder that you see is being untarred is the toolchain. So, maybe the Java bundle you downloaded is being interfered with by the browser that downloaded it. You could try right-clicking on the link once you’ve agreed the Oracle EULA and copying the URL, then using wget in an SSH session to download it to /volume1/public on the NAS.

      6. Novate's avatarNovate

        I’m located in Norway, could that make a difference? Not sure if the DSM has some setting for CIFS relating to codepages or similar – I don’t remember setting one…

      7. Novate's avatarNovate

        Hi Patters,

        I got some time to troubleshoot the Java 6 install last night.
        I downloaded Java 6 and the 3.1 toolchain again, making sure the versions I got were correct and tried to reinstall – and got the same error message “Failed to install the package”. I closed the dialog, and was about to uninstall the package and try again using SSH wget, but then it hit me: what if the error message is an error itself…

        I tried installing the Subsonic package, and viola – it works! (mostly that is). It appears that the message about the failed install is in error . Not sure why it comes up (maybe something with DSM 4.0?), but the Java 6 install is usable anyhow it appears.

        Now I just have to figure out how to get transcoding of videos via FFMPEG to work. (just get a stream of numbers/letters in the flash plugin). Transcoding of wma to mp3 seems to work fine (guess not having lame in the transcode directory isn’t an issue – FFMPEG seems to get all the work).

        If there is anything I can do to help troubleshoot the installation error message, please let me know.

        – N

      8. patters's avatarpatters Post author

        Hi Novate,

        It could be that there are some temporary files/folders in the public folder from previous failed or manual attempt that are stopping the script from completing successfully. If you find a folder in public starting with ejre then delete that and try again. Similarly, delete the one from the extracted toolchain too. Hopefully that should be it.

        P

  6. Tuy's avatarTuy

    Hello,
    I have a syn ds3611xs, dsm 3.2 / 1955.
    Have added in source: http://pcloadletter.comlu.com
    but i cannot see Java packet.
    Tried to download from Oracle but when i try to install get an error: File format invalid.
    The file name is: ejre-7u2-fcs-b13-linux-i586-headless-22_nov_2011.tar.gz

    Thanks and Regards,
    Tuy

    Reply
    1. patters's avatarpatters Post author

      Hi, I can see from the repo logs that your CPU type is announced as bromolow. I have made a change which should allow you to see all the packages intended for x86 as well. I’m not sure whether they will actually work, but I think they should.

      Reply
      1. Tuy's avatarTuy

        Hello Patters,
        Thanks for your very quick reply..
        I can see them now but i became error : This package is not supported on disktation?

      2. patters's avatarpatters Post author

        I have edited the package header to allow for install on bromolow CPU type. Can you download this test version to your computer, and manually install in Package Center using this file:
        http://dl.dropbox.com/u/1188556/java1.6.0_30-x86-006-test.spk

        Once you have installed Java, you should be able to start an SSH session and type java -version.
        Let me know if it works and I’ll update the other Intel packages so they install on bromolow.

  7. Tuy's avatarTuy

    Hi,
    I downloaded the version 6 and put it in Public like the toolchain,
    it installed without problem.

    Is it normal that the status is = Stopped and I have no option tun run, the only one option is to uninstall ?

    I installed Minecraft server it seems to run

    Reply
      1. Tuy's avatarTuy

        Hi Patters,
        I didn’t know how, now loaded Putty, here what comes after the command java -version:

        java version “1.6.0_30”
        Java(TM) 2 Runtime Environment, Standard Edition for Embedded (build 1.6.0_30-b12, headless)
        Java HotSpot(TM) Client VM (build 20.5-b03, mixed mode)

        Regards,
        Tuy

  8. George's avatarGeorge

    Hi; I’ve tried installing Java 1.6 on DSM 3.2.1955 with no luck. I created the “public” shared folder and even got the specific ejre version mentioned in the preinstall script, but no luck. Maybe the ‘live’ package uses another.

    I then tried Java 1.7 with http://download.oracle.com/otn-pub/java/ejre/7u2-b13/ejre-7u2-fcs-b13-linux-arm-sflt-headless-22_nov_2011.tar.gz and that finally worked!

    Could you please mention the exact Java releases needed for the packages to work (maybe in the spk description of something)?

    This was crazy frustrating also because Oracle gives you no way I could find to get older releases. I hacked the urls together to be able to download them.

    Regards,
    George.

    Reply
    1. patters's avatarpatters Post author

      The package clearly displays the filename of the required JRE bundle in an error message on screen when it is missing. I’m not sure what more I could do.
      Your comment prompted me to go and sign up to Oracle again for both Java downloads. I can confirm that the packages are still in step with the most recent Oracle releases. If you’re trying to modify URLs you must be doing something wrong. It’s ARMv5 not v6 or v7.

      Reply
  9. oblo's avataroblo

    Hi,

    I tried to install open remote however when installing java se for embedded 6, it said package broken !!

    So I tried to install the java 7 with sucess (I put in the public folder:
    – ejre-7u2-fcs-b13-linux-arm-sflt-headless-22_nov_2011.tar
    – gcc421_glibc25_88f628x.rar
    then the install goes fine !However, when I goes to the status it said “not started” without option to start it !!

    I have a marvel 88x processor for RS41 synology
    java -version:
    java version “1.7.0_02”
    Java(TM) SE Runtime Environment for Embedded (build 1.7.0_02-b13, headless)
    Java HotSpot(TM) Client VM (build 22.0-b10, mixed mode)

    *so when I try to install open remote it said that I don’t have java 6 !!!

    helppppp ;-))

    Reply
      1. oblo's avataroblo

        ok thanks for the quick reply !!

        I installed java 6 from http://www.openremote.org/display/docs/OpenRemote+2.0+How+To+-+Controller+on+Synology+NAS

        and installed the spk file http://www.openremote.org/download/attachments/19432921/java1.6.0_27-88f6281-v3.spk?version=1
        it looks ok and I start the package !

        When I try to install the open remote package I have no java 6 installed !

        here is what java -version give me
        java version “1.6.0_27”
        Java(TM) 2 Runtime Environment, Standard Edition for Embedded (build 1.6.0_27-b07, headless)
        Java HotSpot(TM) Client VM (build 20.2-b06, mixed mode)

      2. patters's avatarpatters Post author

        Ah, the problem is that the OpenRemote package’s Java 6 prerequisite in fact checks for the presence of my Java 6 package. If you installed it manually, Package Center doesn’t know about it. You have installed the 1.6.0_27 version. My spk requires the Oracle file for version 1.6.0_30. You cannot rename a different version of the file and hope for the best since the folders inside the archive are different.

    1. patters's avatarpatters Post author

      Good good. You’ll need to reverse the manual changes you made before though.
      How did you end up downloading the older version though (since this seems to be tripping a lot of people up)? Is that because you used an old confirmation email from registering with Oracle a few months ago? Or a link someone else provided perhaps?

      Reply
  10. Ed's avatarEd

    Hi Patters,

    Just wanted to say thank very much for taking time out of your life to not only produce this but to give the support you have. For me it worked first time with Java 7 on DS211j.

    I’d like to buy you a drink for your efforts good sir, if you have a donate/paypal mail me with the details!

    Cheers!

    //Ed

    Reply
  11. jaroslav's avatarjaroslav

    hi all,

    can you please help me ?
    I just can’t get download link for java from Oracle after filling their registration … am I missing something ? Is there any other way to get java se ?

    Reply
    1. patters's avatarpatters Post author

      The process on the Oracle website is a bit confusing. You fill in the survey (only some of the fields are required), then you land on a page that says thank you for the information. But on that page you also have to click something else before it actually sends you the email.

      Reply
      1. jaroslav's avatarjaroslav

        thanks for reply, there was some submit button, I’ve clicked, but I’m going to give it another try …

  12. Bart's avatarBart

    Why is java not working?

    I’m getting: “DiskStation> java
    -ash: java: not found”

    More information:

    DiskStation> echo $JAVA_HOME
    /volume1/@appstore/java7/jre
    DiskStation> echo “/volume1/@appstore/Java SE for Embedded 7” | sed -r ‘s/(.*\@a
    ppstore).*$/\1\/java/’
    /volume1/@appstore/java

    Can you help me?

    Reply
    1. Bart's avatarBart

      Also my path information from my profile:

      PATH=/opt/bin:/opt/sbin:$PATH
      PATH=$PATH:/volume1/@appstore/java7/jre/bin
      JAVA_HOME=/volume1/@appstore/java7/jre
      LANG=en_US.utf8
      export JAVA_HOME LANG PATH

      Also Crashplan is working fine..

      Reply
      1. patters's avatarpatters Post author

        Not sure I’m afraid. Maybe you have something else that’s overriding the value for one of those variables. At least it works for the daemon users though. I notice from your PATH variable that your NAS is bootstrapped. Perhaps you had previously had a manual install of Java on there and haven’t undone all the changes when you removed it.

      2. Bart's avatarBart

        Thanks for you comments.

        I had previously installed java6 once, with you package.

        What can I do to run something like this:

        “java -jar Application.jar –help” for example

      3. Bart's avatarBart

        DiskStation> echo $PATH
        /opt/bin:/opt/sbin/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin

      4. patters's avatarpatters Post author

        I don’t know why, but something has overwritten your PATH variable after ~/.profile has loaded. If you type:
        PATH=$PATH:/volume1/@appstore/java7/jre/bin
        export PATH

        then it should work.

  13. Christian's avatarChristian

    Hi oblo,

    where do u get this java version? I am not able to install with the one from Oracle.

    Greets
    Chris

    Reply
  14. Richard's avatarRichard

    If i check in my packages on my 1812+ after entering your repository, I don’t see the java package in the possible installation packages? What do i do wrong??

    Reply
    1. patters's avatarpatters Post author

      From my repo logs I can see that this is a new Synology CPU identifier (cedarview). I’ll have to update all the intel packages – hopefully tomorrow.

      Reply
      1. Richard's avatarRichard

        Is it also possible to tell crashplan, it can only use my 2nd NIC to up and download backups?
        Telling him to listen to only the 2nd NIC for client connection already succesfull

      2. patters's avatarpatters Post author

        Hmm, I think that would be one to ask on the CrashPlan forums since it’s not a Synology-specific question.
        Out of interest, if you start an SSH session and run this:
        locale -a
        does it work? You should see:
        ~$ locale -a
        C
        en_US.utf8
        POSIX
        ~$

        I just want to check there aren’t any 32/64bit issues with the locale support in the Java package on cedarview CPUs.

  15. Pio's avatarPio

    Hi,
    when i am trying to install “Java SE for embedded 6” throu the repo “http://pcloadletter.comlu.com” in my DS411 (3.2) i always get the error “download failed”. So i can’t install the version 6 on my DS411!
    Installing der Java version 7 is without any problems!
    Any solutions? Is the link down or something like that?
    Thank you.

    Reply
    1. patters's avatarpatters Post author

      It definitely works for me, so I can only conclude that Dropbox has an old version on some of its mirrors or something. Try again now, I’ve linked to a new filename.

      Reply
      1. Pio's avatarPio

        No change. Still “download failed” and “Java SE for embedded 6 damaged” in Package Center in DSM.
        :-(

      2. patters's avatarpatters Post author

        How about now? It looks like the checksum could have been wrong, but I’m not sure how I could have had it working on DSM 4.0 with an invalid one.

  16. Pio's avatarPio

    Still not working. When i click install in the package center, i see the download starting, but at something about 20% the download stop und the messages above appear…
    To get it right: i put these files into my private folder:
    ejre-1_6_0_30-fcs-b12-linux-arm-sflt-eabi-headless-10_nov_2011.tar.gz
    gcc421_glibc25_88f628x.tgz
    This ist correct, isn’t it?
    This sucks…

    Reply
      1. patters's avatarpatters Post author

        Great, thanks for the feedback. I guess maybe it was a glitch with a particular build of DSM 3.2 perhaps.

  17. alex's avataralex

    Hi, first of all thanks for the package.
    My question is, when my DS is idling (no applications are running, no downloads, no backups and no java applications) i have around 50% cpu load from java se 7.

    Is that normal? When not, how can i fix it?

    Reply
    1. patters's avatarpatters Post author

      No that’s not normal. Where are you seeing that – in the DSM GUI, or by running top in an SSH session? Java doesn’t run in the background unless it has been invoked to run some Java code. In the output of the top command (Ctrl-C to cancel) you can see what the command line it was invoked with, and therefore which app. It could be that something had not quit properly. Did you upgrade a package? Somethings this does happen. Killing that individual process should fix it, or else just restarting the syno.

      Reply
  18. Wilco's avatarWilco

    Ok read a lot now, but I cannot install the java package on a DS207. Is it even possible to install this package for this machine. I saw that there was a problem for the DS207+, maybe this thing won’t work on a DS207 also?

    Reply
    1. patters's avatarpatters Post author

      As I’ve explained many times before on here it’s no I’m afraid – the glibc version that Synology DSM for PowerPC uses is too old. Your best hope would be OpenJDK but I’m not sure that’s viable yet.

      Reply
  19. Chacal's avatarChacal

    Hi

    I’ve got a 710+ and downloaded the file from oracle as mentionned.
    The filename is “ejre-7u2-fcs-b13-linux-i586-headless-22_nov_2011.tar.gz”.
    I put it in the public folder, but still the install says it’s missing.
    Do you have any idea why it doesn’t work?

    Greetz

    Reply
    1. patters's avatarpatters Post author

      There is no Java 7 package for Intel since it doesn’t work on Intel Synology units, so you want to download the Java 6 file – not that one. Look at the error message again, it does tell you the filename it’s expecting.

      Reply
  20. Viand0x's avatarViand0x

    Hi
    Thanks for these packages, you make a great job!

    I’m having a problem with the java package. I’ve installed it on my DS211+ (and worked fine) but since I migrate to my new DS712+ I can’t install it.
    My mistake was perhaps not to uninstall java before migrate, because now I see java in the installed packages but it don’t work (java -version returns : -ash: java: not found ). I tried to uninstall. I had the confirmation but nothing changed in /volume1/@appstore/java6 . So I manually delete this folder. Now when I install, the script ask for the 2 files:
    ejre-1_6_0_30-fcs-b12-linux-i586-headless-10_nov_2011.tar.gz
    gcc420_glibc236_pineview.tgz
    they’re in the public folder, so the installation continue and after a while I have an error message “Echec d’installation du paquet” (yes, I’m french).
    After migrating to the DS712+ I’ve update it to DSM 4.0

    How can I fix this?

    Reply
    1. patters's avatarpatters Post author

      So you migrated the disks from an ARM CPU to an Intel CPU NAS without deleting them? I wonder how the OS would handle that, since all apps are installed to the data partition (volume1 usually). You could try to manually clean up the remains of the previous app install by deleting the content from /var/packages/java6 and /volume1/@appstore/java6. I think that ought to do it.

      Reply
      1. Viand0x's avatarViand0x

        I know, I know, I didn’t think about it at all… I only use subsonic to manage the albums images, so I don’t keep it in mind…
        btw I’ve already deleted these folders, and still have the same error….

  21. burgessg's avatarburgessg

    Hi Patters. Looks like you new a FAQ for this, since you keep getting the same dumb questions.

    Here’s a new (an particularly dumb) question, from a new Synology owner:

    What’s so geat about Serviio — there are already a few media servers available for Syno NAS’s aren’t there?

    I take it Serviio needs this Java version because jamvm is too old?

    Reply
    1. patters's avatarpatters Post author

      Yep. Most of the questions people ask are answered in the main blog posts. In answer to yours, Jamvm is only Java 1.5. Serviio needs 1.6 minimum. Serviio offers very good device support with minimal transcoding, far better than the built-in media server, and in terms of “just works” it’s way ahead of most of the competition. The online streaming and live streaming breathe new life into even quite old TVs.

      Reply
      1. patters's avatarpatters Post author

        It’s set to a nice long random value, but if you do want to change it, use the User section of the DSM Control Panel. You don’t need to update any scripts. Packages are invoked by root (I then use su to switch to the daemon user). So the scripts can tolerate a password change.

  22. Ben's avatarBen

    Trying to install Java to get Serviio on my DS212J.

    Have tried to install Java – get “Failed to Install Package” error at end (but Java appears under installed in Package Manager)
    Have tried both 6 and 7.
    Telnet “java -version” gives me java not found

    Installing serviio over a failed installation, installs serviio but does not run at all.

    Any ideas appreciated.

    Thanks

    Reply
  23. Paul Johansen's avatarPaul Johansen

    I am having a similar problem to some of the posts mentioned above. I have a 1511+ and have downloaded both of the following files into a public share I created:
    ejre-1_6_0_30-fcs-b12-linux-i586-headless-10_nov_2011.tar.gz
    gcc420_glibc236_pineview.tgz

    The install works fine, but even after reboot I cannot type java-version (I am logged in as root). I receive “-ash: java: not found”.

    If I enter the commands listed above (swapping out jre7 for jre6):
    PATH=$PATH:/volume1/@appstore/java6/jre/bin
    export PATH

    Then java -version works fine. Until I reboot the NAS, then it doesn’t. My NAS has never been bootstrapped or anything. I am on DSM 4.0-2198.

    Any ideas on why this is happening?

    Reply
    1. patters's avatarpatters Post author

      Did the package report an error at the time you installed it? Have a look at my postinst script above in the blog post. As you can see, it just appends a couple of lines to /etc/profile to set the PATH and JAVA_HOME variables. Can you check that file? Can you see those changes there? Maybe it’s not sourcing /etc/profile for the root user for some reason.

      Reply
      1. Paul Johansen's avatarPaul Johansen

        No errors when it was installed and it looks like /etc/profile looks fine. Here are the lines out of that file:

        PATH=/opt/bin:/opt/sbin:$PATH
        PATH=$PATH:/volume1/@appstore/java6/jre/bin
        JAVA_HOME=/volume1/@appstore/java6/jre
        LANG=en_US.utf8
        export JAVA_HOME LANG PATH

        My main goal was to get CrashPlan up and running and that is working fine, so maybe it isn’t a big deal. Just seems strange.

  24. Charles's avatarCharles

    Has the Java 7 package been removed? I added pcloadletter.comlu.com to my package sources, but I only see a package for Java 6, which as far as I can tell is no longer downloadable.

    Reply
      1. Charles's avatarCharles

        Thanks for the quick reply. I’d had a hard time finding the Java 6 installer (user error on my part), and didn’t realize the Java 7 syno package referenced on your blog was only for non-intel. I’ve successfully installed Java 6 via your package and everything looks good.

        Thanks again!

  25. Craig's avatarCraig

    Arg. I really messed this up. I hope you are willing to help when I really shot myself in the foot here.

    I had wanted to install CrashPlan and so followed some recipe recommended elsewhere (this was before yours was available). In doing so I had ended up with Java on my system.

    Recently I came across your CrashPlan package and wanted to move over to using that, so uninstalled CrashPlan and tried to also uninstall Java, thinking that I had let CrashPlan install it. I asked CrashPlan for help, but all they did was point me to an Oracle page on it. I deleted the directory I found it in (/volume1/@appstore/java7/jre) and restarted my DS210j. When I went in to the Package Center in DSM I noticed that Java SE for Embedded 7 was one of the packages and its status was stopped.When I went to look for more details I noticed that it was a package by patters! Whoops!

    So now I am in limbo. I have trashed the jre directory but my DS thinks the package is installed (but stopped).

    How can I tidy all of this up? I would really appreciate some pointers as to how what I need to do. Thanks!

    Reply
    1. patters's avatarpatters Post author

      If you deleted the folder /volume1/@appstore/java7 then just recreate it using:
      mkdir /volume1/@appstore/java7

      Then uninstall Java through Package Center. It should be fine – the script doesn’t care whether Java actually works or not before it uninstalls it. Then you can reinstall it.

      Reply
      1. Craig's avatarCraig

        Thanks! Worked fine.

        …but, now I can’t install the Java package. It keeps saying “The operation failed. Please log in to DSM again and retry.” Which I did and it keeps failing. I have tried downloading Java and the toolchain using Chrome and Firefox in case it was the browser – same result. I am logged in to DSM as admin, i tried logging in as root in case that was it, but I can’t log in to DSM as root.

        What else can I try?

  26. Arie's avatarArie

    I try to install the package, but have a problem with the toolchain.
    The package expects a .tgz file, but in the suggested download area, I can only find a .gz file.
    How can I fix this?

    Reply
    1. Arie's avatarArie

      btw, with .gz I don’t meant tar.gz. The full filename is gcc421_glibc25_88f628x.gz Renaming to .tgz doesn’t work.

      Reply
    2. Arie's avatarArie

      Strange, after installing I get the error that the package cannot be installed, but I now do see it between the installed packages.
      I redownloaded with FF, and now the extention was tgz, but it still gave the same error after installing and also it appeared in the installed packages list.

      Reply
      1. Craig's avatarCraig

        The error message is:
        “The operation failed. Please log in to DSM and retry.”

        I tried restarting the Syno and logged in as root tried “java -version” and got the message
        “-ash: java: not found”

      2. Craig's avatarCraig

        I had a look at your postinst script and have noticed a couple of things.
        1) When I log on as root the path is “/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin”, note no mention of java
        2) The script /etc/profile does seem to set the path to include the java dir
        3) /root/.profile does not mention java, and it is this path that seems to be my current path
        4) $JAVA_HOME *is* set

      3. patters's avatarpatters Post author

        My packages run as separate users (not as root) so it should still work, despite the error. I’ll look into trying to fix this in the next release.

      4. Craig's avatarCraig

        Ok, I think I understand. So for the users that actually run the system it is ok, but not for me when I log on? That is fine. But it was confusing at first as you say to test log on and type “java -version” which will not work as the path is not set.

        But it does seem to be installed and all working fine despite the issues I was having. Thanks again for the efffort in making this available and in supporting it.

      5. Arie's avatarArie

        Mine is working now. The error was that the installation failed.
        But at some point after the installation failed, I noticed the Java package moved to installed packages after all.
        Java dependent packages work fine with it.

  27. Leonardo's avatarLeonardo

    Hi patters. I am having trouble installing Java7. I´ve downloaded the 2 files, placed them in /volume1/public (which is writable by everyone), and when I try to install Java 7 it just says “Erro ao instalar o pacote” – which is portuguese for “Error installing package”, or something like that (I dont know the exact original message).

    In /var/log/messages I found the error:

    PkgMan.cgi: pkgtool.cpp:2007 Failed to run postinst script

    How can I know the exact error ? Is there a way to debug package instalation in synology ? I tried “synopkg –help” and “man synopkg”, but there is no help….

    Reply
    1. patters's avatarpatters Post author

      Hi, not sure about this. Some people have reported something similar but then found that it had in fact installed. I think one person said the problem went away after he restarted the NAS. I’m not sure how you get any debugging info about the scripts, other than what you already found. You could look through postinst yourself (it’s on the blog post) and see if there’s a particular part of it that’s not working. Is your primary storage volume called /volume1? When I made the script I thought detecting the names /volume1 to /volume999 would be sufficient, but can you believe that someone on here has /volume1000, so I need to amend the script.

      Reply
  28. ghettohobo's avatarghettohobo

    Hi there I have installed java 7 but I would also like to install tomcat 6 on my NAS. Do you know how I would go about doing this?

    Thanks

    Reply
    1. patters's avatarpatters Post author

      Not really. The OpenRemote package uses it so you could have a look at how that works. There are two ways you could do it – a more generic Linux way, or making a package so that you can easily add/remove it and so that it would survive DSM upgrades. You can see all my package scripts on here, and there is a good packaging guide on the Synology wiki.

      Reply
  29. John's avatarJohn

    Thanks Patters for all the hard work it took some time but it all worked for me. I have a DS1010+ and installed Java 6, then Servio, then CrashPlan. Am I correct in thinking that when I only see Java SE for embedded 6 that 7 won’t work on the DS1010+? Will post some tips that may help with Crashplan. Used Chrome that modified the Java file so used FireFox that didn’t when I downloaded the package.

    Reply
  30. Ladislav's avatarLadislav

    hi,
    i got problems to instal Java on DMS 4.0, always error with missing file in volume1/public….tar.gz
    I do not see the folder – only public but not volume1 before and I do not also have the right name of tar.gz (I downloaded what I could from Oracle.
    could someone help how to handle?

    Reply
    1. patters's avatarpatters Post author

      /volume1/public is the full Linux folder path on the NAS itself. If you’re browsing your NAS from another computer you’ll only see ‘public’, so that’s normal. As mentioned in the notes – many web browsers/OSes try and mess with the gzipped tar files instead of leaving them alone (Mac OS/Safari will un-gzip to .tar, IE renames to .tar.tar or something crazy, and so on. If in doubt, try using Firefox – that’s usually ok in my experience.

      Reply
    2. John's avatarJohn

      I used Firefox on my PC to download the file, to the public folder n the NAS (that I had to create). Easier if you have used the “Map Network drive…” function for example on Windows so that you can browse directly to the NAS folder when saving the file. Google Chrome as patters was saying ‘unzipped’ the file and hence it had the wrong name so I just used FireFox instead and that worked fine. Check the file is in the “public” folder and has the right name? The error message gives you the full path of where it should be and what it should be called.
      If FireFox has downloaded the Java package to the Downloads folder then just copy the file over to the ‘public’ folder on your NAS

      Reply
  31. Ladislav's avatarLadislav

    I renamed and instalation of java started, later on came error: gcc421_glibc25_88f628x.tgz missing. so I downloaded and placed to public. Again tried instalation of Java6, it instaled quite long time but at the end message, try again, was not successfull… any advice?

    Reply
      1. Ladislav's avatarLadislav

        rebooted, but Java6 is no more offered in package manager in your source, what to do?

      2. Ladislav's avatarLadislav

        still not working, here is summary of steps i did:

        version DSM 4.0
        1. connected to source http://pcloadletter.comlu.com
        2. registred at oracle and loaded to public file: ejre-7u2-fcs-b13-linux-arm-sflt-headless-
        22_nov_2011.tar.gz

        3. tried to instal Java 7 from your source
        4. came error – missing file: gcc421_glibc25_88f628x.tgz , so I downloaded in firefox and coppied to public folder
        5. restarted synology
        6. tried to instal java 7
        7. no errors comming, long instalation done, result – “Try again, was not done completely”
        8. Java 7 is among installed program – but with status “Stopped” and there is not button to “run” – so I assume, this is wrong installed
        9. Servio is installed, but on console there are errors – comes error message: Seems not running…. and no reaction to savings….

      3. patters's avatarpatters Post author

        Java does not run like other packages, so that’s normal. You need to allow Serviio a minute or two to start before you attempt to configure it.

      4. patters's avatarpatters Post author

        Can you ask about Serviio on the Serviio blog post please to keep comments on topic.

        You add folders which already exist on your NAS to the library. Serviio will scan them at intervals. Make sure though that the user “serviio” is granted access in DSM to the shared folders which contain your media.

  32. Giansilvio's avatarGiansilvio

    Hi,

    Not sure were to post, here or on the Serviio package page, but I’m quite sure my problem is with Java. I have a DS209, and for almost a year I had Serviio 0.5.2 installed using your guide and working perfectly fine. As they say ‘if it ain’t broke…’

    However I decided it was time to upgrade, so I tried to manually uninstall it following your instruction, but I must have done something wrong as the Diskstation stopped working and I had to re-install DSM 4.0.

    I followed your instructions to install Java, and the installation seemed to work fine, but at the end I would get an error message saying that the package was not installed, although it showed as installed in the package centre. I tried to install Serviio, but although installed, it would not work properly.

    Next I decided to do a manual install of Java following instructions in the Serviio 0.5.2 post and that almost worked except that I get an error that it can’t find directories when trying to copy these two files:

    cp -R i686-linux-gnu/i686-linux-gnu/share/i18n /usr/share
    cp -R i686-linux-gnu/i686-linux-gnu/share/i18n /opt/share

    and if I type java -version I get

    -ash: java -version: not found

    However if I install Serviio this time it seems to work, I can set up shares, it recognise my players, and seems to be able to stream photos and music to my Sony Bluray player, but when I look at videos I get the message that there are no playable files in the folder.

    I assume that my problem is with Java, and I realised from reading posts in this forum that there is a problem with Chrome ( which I used to download files). If I try to run the installer from the Package Centre however I get a message that “It seems from /etc/profile that a Java Runtime is already installed at /opt/java/ejre1.7.2_02. uninstall it and try again”

    Sorry for the longwinded post, I hope it’s not too confusing, but I’m not sure what to do next. Maybe I should re-install DSM 4.0 again and start from scratch, or is there something less dramatic to try first?

    Please help

    Reply
    1. patters's avatarpatters Post author

      You can stop my Java installer from complaining about an existing Java install by removing the edits you made to /etc/profile when you manually installed Java. The cp commands you can’t get working are the part where the locale support stuff is extracted from the Synology toolchain. Without that you won’t have support for unicode characters in filenames, which is obviously a deal breaker outside of the US/UK.

      Reply
      1. Giansilvio's avatarGiansilvio

        Hi Patters,

        Thanks for quick reply. When I went to revert the changes made to opt/etc/profile and etc/profile I realised that I had made a mistake when I initially modified them. After correcting the mistake I went into i686-linux-gnu/i686-linux-gnu/share and copied i18n from there which seemed to work. That fixed my manual java installation and now if I type java -version I get the proper message telling me that java version 1.7.0_02 is installed. After this I re-installed Serviio from your package and everything is working fine again.

        At the end it was all my mistake, but thanks for your help and many thanks for creating these packages. Great work.

  33. Hjalmar's avatarHjalmar

    Hi Patters!
    I know it has been mentioned before, but when I install java (6 or 7, have tested with both), I get a “fail to install package” (the necessary files are located in public with the correct name). I can install Serviio, but I can’t run the console. It just shows a blank page.
    Rebooting doesn’t fix it.

    I have a 212j and DSM 4.0-2219.

    Any idea on what to do?

    Reply
    1. Hjalmar's avatarHjalmar

      I tried once more to install Java, and the “Failed to install package” appeared. But I then SSH java -version and it showed me that Java was installed. Installed Serviio and it worked!
      My files in volume1/public are:
      ejre-7u2-fcs-b13-linux-arm-sflt-headless-22_nov_2011.tar.gz
      gcc421_glibc25_88f628x.tgz
      The output of locale is similar to “uncola” below (can’t remember if it differ).

      Reply
  34. uncola's avataruncola

    Thanks for the awesome packages! I got serviio and subsonic working on my 1511+. Java gave an error about failing to install but afterwards worked just fine. I ran into nearly every possible problem when installing but they could all have been avoided if I read your instructions and followed them to the letter the first time heh. Chrome kept decompressing the tar.gz file for me and I had to use firefox to download it. Had to create a public folder and turn on user home too. One thing I noticed.. after installing serviio, I immediately went to the web gui for it and it gave errors that said serviio wasnt’ running. I assumed that meant my serviio was broken, but in hindsight I think I just had to wait longer for serviio to finish loading. I reinstalled it and it worked the second time but I think that was just because I waited longer before going to the serviio webgui. Thanks again, serviio fixed a problem for me I was having with the default synology media server.. I couldn’t skip ahead while playing flacs for some reason. WIth serviio I can.. using plugplayer for ios

    Reply
    1. patters's avatarpatters Post author

      I’m fixing a couple of scenarios on the Java package install but I still can’t find what’s causing the ‘Failed to install package’ error. Since Java still works in these cases I’m assuming it must be related to extracting the toolchain. You definitely used the 3.1 toolchain, right? In the interests of fixing it once and for all, can you give me the output when you run:
      locale

      Reply
  35. uncola's avataruncola

    Yes I definitely used the 3.1 toolchain. Here’s the output of locale:

    DiskStation> locale
    LANG=en_US.utf8
    LC_CTYPE=”en_US.utf8″
    LC_NUMERIC=”en_US.utf8″
    LC_TIME=”en_US.utf8″
    LC_COLLATE=”en_US.utf8″
    LC_MONETARY=”en_US.utf8″
    LC_MESSAGES=”en_US.utf8″
    LC_PAPER=”en_US.utf8″
    LC_NAME=”en_US.utf8″
    LC_ADDRESS=”en_US.utf8″
    LC_TELEPHONE=”en_US.utf8″
    LC_MEASUREMENT=”en_US.utf8″
    LC_IDENTIFICATION=”en_US.utf8″
    LC_ALL=

    Reply
    1. patters's avatarpatters Post author

      Had you previously manually installed the locale support, for instance by following the Wiki document for a manual CrashPlan install?

      Reply
  36. patters's avatarpatters Post author

    I have updated all the Java packages to the newer versions released by Oracle and made some improvements (see changelog at the bottom of the blog post). Could someone please try the Java 7u4 build for Intel to see if it works? Java 7 has not worked on Intel synos to date which is why I’m not putting it on the repo:
    link removed – it didn’t work

    Reply
    1. Fragglesnot's avatarFragglesnot

      Patters,

      It installs ok on a DS1511+. I checked the log file, and it does report one error, but I’m not sure what to make of it. Any ideas?

      Error: dl failure on line 864
      Error: failed /volume1/@appstore/java7/jre/lib/i386/client/libjvm.so, because /volume1/@appstore/java7/jre/lib/i386/client/libjvm.so: cannot handle TLS data

      System installed locales:
      C
      en_US.utf8
      POSIX

      JAVA_HOME=/volume1/@appstore/java7/jre
      TZ=Canada/Eastern

      Thanks for making the effort! :)

      Reply
      1. patters's avatarpatters Post author

        Yeah that “cannot handle TLS data” means it hasn’t worked (that should display the output for java -version). Same error as before. Thanks for testing Fragglesnot, I guess Intel users will have to carry on using Java 6.

    2. Fragglesnot's avatarFragglesnot

      patters,

      Not sure if you have time or not, but if you think you could get this working, I wouldn’t mind letting you on my system for debug. Let me know if this is something you’d be interested in. I don’t know enough about linux I’m afraid to be of any help.

      Thanks

      Reply
  37. charles's avatarcharles

    problem with the script, I’ve tried like you ve described but when i run it in ssh nothing happens…. Can you help me maybe?

    Reply
    1. patters's avatarpatters Post author

      You’re not meant to run that script. It’s just there for informational purposes so you can see what the package does.

      Reply
      1. charles's avatarcharles

        ow okey i was thinking that it was a sort of package builder… So I have just to read the script and make everything that is said in?

      2. patters's avatarpatters Post author

        Did you add my repo URL to Package Center’s Other Sources tab? Then you just install from there.

      3. charles's avatarcharles

        or do I have to zip myself the requirements files into a spk package with the script?

  38. becos's avatarbecos

    I just uninstalled Serviio and Java 6 package and my NAS doesn’t start anymore! I suppose it has something to do with JAVA uninstallation. Any thaughts???

    Reply
    1. patters's avatarpatters Post author

      No one else has reported this issue. Don’t panic though, you will be able to repair DSM using that update utility from a Mac or PC without losing your data (despite the scary warning message). I’ve done it a few times when I was first messing around with bootstrapping mine.

      Reply

Leave a reply to Ed Cancel reply