Aamirkhan
Aamirkhan

Reputation: 5784

Setting up environment variable in linux

While installing UIMA I got this steps in readme file

* Set JAVA_HOME to the directory of your JRE installation you would like to use for UIMA.  
* Set UIMA_HOME to the apache-uima directory of your unpacked Apache UIMA distribution
* Append UIMA_HOME/bin to your PATH

* Please run the script UIMA_HOME/bin/adjustExamplePaths.bat (or .sh), to update 
  paths in the examples based on the actual UIMA_HOME directory path. 
  This script runs a Java program; 
  you must either have java in your PATH or set the environment variable JAVA_HOME to a 
  suitable JRE.

I opened /etc/environment and perfomed this changes:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/UIMA_HOME/bin"
JAVA_HOME="/usr/lib/jvm/java-7-openjdk-i386"
UIMA_HOME="/root/Desktop/karim/software/UIMA/UIMA_SDK_1.4.5"

after that executed:

UIMA/UIMA_SDK_1.4.5/bin# ./documentAnalyzer.sh

which gave this error:

./documentAnalyzer.sh: 2: .: Can't open /bin/setUimaClassPath.sh

documentAnalyzer.sh code :

#!/bin/sh
. "$UIMA_HOME/bin/setUimaClassPath.sh"
if [ "$JAVA_HOME" = "" ];
then
  JAVA_HOME=$UIMA_HOME/java/jre
fi
"$JAVA_HOME/bin/java" -cp "$UIMA_CLASSPATH" -Xms128M -Xmx900M "-Duima.home=$UIMA_HOME" "-Duima.datapath=$UIMA_DATAPATH" -DVNS_HOST=$VNS_HOST -DVNS_PORT=$VNS_PORT "-Djava.util.logging.config.file=$UIMA_HOME/Logger.properties" com.ibm.uima.reference_impl.application.docanalyzer.DocumentAnalyzer

What is the mistake here? I guess I set environment variable correctly

Upvotes: 0

Views: 921

Answers (2)

Armali
Armali

Reputation: 19375

The order of variable assignments in your /etc/environment is wrong; in order to use $UIMA_HOME in the PATH=..., you have to define UIMA_HOME afore, e. g.

UIMA_HOME="/root/Desktop/karim/software/UIMA/UIMA_SDK_1.4.5"
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:$UIMA_HOME/bin"
JAVA_HOME="/usr/lib/jvm/java-7-openjdk-i386"

Upvotes: 0

Hector Gonzalez
Hector Gonzalez

Reputation: 31

I think the answers given about adding the $ to the variable UIMA_HOME in your PATH variable are correct, but, I think you are also lacking the EXPORT command for your variables. Look, after you set their values, you should also writhe this in /etc/environment:

export UIMA_HOME
export JAVA_HOME
export PATH

That way, you would be able to use them later (always remember to fix the PATH variable with the $UIMA_HOME as well).

If this does not work, try rebooting your computer after setting the variables as I said.

In the case that does not work either, try repeating the process and in a console (after doing everythin all over again) try using the following command:

source /etc/environment

Fianlly, if that does not work, try setting the variables in the file called /etc/profile (do the same process: setting the varialbes and exporting them), and this should work.

Upvotes: 1

Related Questions