Unable to install DHIS2 on my Ubuntu 16.4 (Javascript issue)

I have tried following all the steps with DHIS2 latest version and tried installing errors

root@dhis:/home/dhis# tail -f tomcat-dhis/logs/catalina.out
/usr/share/tomcat7/bin/catalina.sh: 1: eval: /usr/lib/jvm/java-8-oracle//bin/java: not found
/usr/share/tomcat7/bin/catalina.sh: 1: eval: /usr/lib/jvm/java-8-oracle//bin/java: not found
/usr/share/tomcat7/bin/catalina.sh: 1: eval: /usr/lib/jvm/java-8-oracle//bin/java: not found
/usr/share/tomcat7/bin/catalina.sh: 1: eval: /usr/lib/jvm/java-8-oracle//bin/java: not found
/usr/share/tomcat7/bin/catalina.sh: 1: eval: /usr/lib/jvm/java-9-oracle//bin/java: not found
/usr/share/tomcat7/bin/catalina.sh: 1: eval: /usr/lib/jvm/java-9-oracle//bin/java: not found
/usr/share/tomcat7/bin/catalina.sh: 1: eval: /usr/lib/jvm/java-11-oracle//bin/java: not found
/usr/share/tomcat7/bin/catalina.sh: 1: eval: /usr/lib/jvm/java-11-oracle//bin/java: not found
/usr/share/tomcat7/bin/catalina.sh: 1: eval: /usr/lib/jvm/java-9-openjdk-amd64/bin/java//bin/java: not found
/usr/share/tomcat7/bin/catalina.sh: 1: eval: /usr/lib/jvm/java-9-openjdk-amd64/bin/java//bin/java: not found

What might be the issue?

It seems your java (JRE / JDK) is not installed. Or if it is, you might no have it added to your path.

1 Like

Hello thanks for the reply can you assist on this if I can share access? I’m desperate :slight_smile:

Here is my “sudo nano tomcat-dhis/bin/setenv.sh” file and my Java path is: /usr/lib/jvm/java-9-openjdk-amd64/bin/java.

#!/bin/sh

export JAVA_HOME=‘/usr/lib/jvm/java-9-openjdk-amd64’
export JAVA_OPTS=‘-Xmx7500m -Xms4000m’
export DHIS2_HOME=‘/home/dhis/config’

CATALINA_HOME=‘/usr/share/tomcat7’

The first existing directory is used for JAVA_HOME (if JAVA_HOME is not

defined in $DEFAULT)

JDK_DIRS=“/usr/lib/jvm/java-6-openjdk /usr/lib/jvm/java-6-sun /usr/lib/jvm/java-1.5.0-sun /usr/lib/j2sdk1.5-sun /usr/lib/j2sdk1.5-ibm”

Look for the right JVM to use

for jdir in $JDK_DIRS; do
if [ -r “$jdir/bin/java” -a -z “${JAVA_HOME}” ]; then
JAVA_HOME_TMP=“$jdir”
# checks for a real JDK like environment, needed to check if
# really the java-gcj-compat-dev package is installed
if [ -r “$jdir/bin/jdb” ]; then
JAVA_HOME=“$JAVA_HOME_TMP”
fi
fi
done

Default Java options

if [ -z “$JAVA_OPTS” ]; then
JAVA_OPTS=“-Djava.awt.headless=true -Xmx128M”
fi

What happens if you write java on the console?
Also, I see you are following the guidelines… but are you launching the tomcat with as the dhis user?

Here is what I get when I write java

root@dhis:/home/dhis# java
Usage: java [options] class [args…]
(to execute a class)
or java [options] -jar jarfile [args…]
(to execute a jar file)
or java [-options] -mp -m | /
(to execute the main class in a module)
where options include:
-d32 use a 32-bit data model if available
-d64 use a 64-bit data model if available
-server to select the “server” VM
-zero to select the “zero” VM
The default VM is server.

-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
              A : separated list of directories, JAR archives,
              and ZIP archives to search for class files.
-mp <module path>
-modulepath <module path>...
              A : separated list of directories, each directory
              is a directory of modules.
-upgrademodulepath <module path>...
              A : separated list of directories, each directory
              is a directory of modules that replace upgradeable
              modules in the runtime image
-m <modulename> | <modulename>/<mainclass>
              the initial or main module to resolve
-addmods <modulename>[,<modulename>...]
              root modules to resolve in addition to the initial module
-limitmods <modulename>[,<modulename>...]
              limit the universe of observable modules
-listmods[:<modulename>[,<modulename>...]]
              list the observable modules and exit
-D<name>=<value>
              set a system property
-verbose:[class|gc|jni]
              enable verbose output
-version      print product version and exit
-showversion  print product version and continue
-? -help      print this help message
-X            print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
              enable assertions with specified granularity
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
              disable assertions with specified granularity
-esa | -enablesystemassertions
              enable system assertions
-dsa | -disablesystemassertions
              disable system assertions
-agentlib:<libname>[=<options>]
              load native agent library <libname>, e.g. -agentlib:jdwp
              see also -agentlib:jdwp=help
-agentpath:<pathname>[=<options>]
              load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
              load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
              show splash screen with specified image
@<filepath>   read options from the specified file

Yes I logged in I am not sure if I do it right, it is my first time working with Lunix commands.

You should not be running as root but as dhis user as explaining the Running section here: System Administration Guide - DHIS2 Documentation

sudo -u dhis tomcat-dhis/bin/shutdown.sh

I have managed to install the DHIS2 system by following the tutorial here: dhis-2.blogspot.com.

Thank you for all the replies and support.

2 Likes