[greenstone-users] Install Problem

From Anupama of Greenstone Team
DateThu Feb 5 13:30:36 2009
Subject [greenstone-users] Install Problem
In-Reply-To (1233769703-4989d4e765771-mail-inbox-lv)
cchap@inbox.lv wrote:
> Thanks for the reply, I am relatively new to linux & svn could you
> please explain how I set JAVA_HOME enviroment variable.
Sure. JRE stands for Java Runtime Environment which allows you to run
precompiled Java code. JDK stands for Java Development Kit which allows
you to compile java code, and since it includes the JRE, allows you to
run it as well.

Because you have obtained your code from svn, you would have downloaded
only the source, which means it needs to be compiled up. This is why you
need the JDK: the build.xml file that Apache Ant is trying to read to
execute the compilation is looking for tools.jar in your JDK installation.

1. First you need to find out whether you already have the JDK installed
on your machine. Open up an xterm and type:

> whereis java

If you have Java installed, then the above will print one or more
directory paths to where different Java installations are located on
your machine.

3. If it lists any path containing "jdk" in it, then you've found the
path you will be using. You will need at least version 1.4.2 or later (I
have it set to JDK 1.5.0 at them moment).

If you don't have any JDK installed already, you will need to download
the linux version and install it. Unfortunately, I can't tell you how to
do this as I've never installed Java on Linux myself: the Technical
Support here already had it installed on all the Linux machines.

4. Once you have installed JDK, its installation location is the
directory path we'll need to provide to the JAVA_HOME environment
variable, as this will tell all programs that use Java where to find it.

To set this on Linux, you will either need to:

a. Type the following two lines in an x-term
> export JAVA_HOME=/full/path/to/your/top/level/jdk/folder
> export PATH=$JAVA_HOME/bin:JAVA_HOME/bin/javac:$PATH
(Don't forget to put the $PATH at the end of the second statement, which
prepends the JDK bin folder to whatever is already stored in your PATH

Then to check what's stored in these two variables, you can do:
> echo $JAVA_HOME
> echo $PATH

To check that your machine now knows where to find java, you can type
the following to invoke the compiler:
> javac
This should present you with java's own message for how to invoke the
javac compiler. If such a message appears then you've set JAVA_HOME

The above method for setting JAVA_HOME (and PATH) will need to be done
every time you launch a new xterm or log on to your Linux machine.

b. Alternatively, to permanently set the JAVA_HOME environment variable
and permanently update the PATH variable to include your JDK's bin
folder, you will need to put the PATH and JAVA_HOME export statement
into your .profile file, if you have one, or otherwise open0 up your
.bashrc file and put these two statements in there. Launch either file
with your Linux text editor (say gedit) as follows:
> gedit ~/.profile
If it's empty, you may not have a .profile file. In that case, open up
.bashrc in a text editor:
> gedit .bashrc

Now type your PATH and export command into here on two separate lines
and save the file.

For example:
export JAVA_HOME=/opt/j2sdk1.4.2_13/

(Once again, don't forget to concatenate the $PATH at the end of the
first one.)

Finally, source the updated script file:
> source ~/.profile
> source .bashrc

Echo the contents to see if it has now loaded the updated variables:
> echo $JAVA_HOME
> echo $PATH

5. Now go into your Greenstone 3 installation directory and try running
> ant prepare

Does it work this time (has it stopped complaining about missing the
tools.jar file)?


> Quoting *Anupama of Greenstone Team <greenstone_team@cs.waikato.ac.nz
> <mailto:greenstone_team@cs.waikato.ac.nz>>*:
> Hi Chris,
> This problem sounds vaguely familiar. I think long ago I had
> encountered
> this problem too. Since you are using svn, I am assuming you know what
> environment variables are and know to distinguish between JDK and JRE.
> Can you see if your JAVA_HOME environment variable is set and is
> pointing to your JDK instead of a JRE?
> The reason I think you need JAVA_HOME to be set to the JDK, is that the
> tools.jar, which Apache Ant is looking for to execute the "ant prepare"
> step, is located inside the JDK directory and not the JRE.
> Tell us if this doesn't work.
> Regards,
> Anupama
> cchap@inbox.lv wrote:
> >
> > Hi,
> > I am attempting to install Greenstone 3 via SVN in Opensuse 11.1
> > 64 bit.
> >
> > When I ant prepare I get the following error message:
> >
> > Unable to locate tools.jar. Expected to find it in
> > /usr/lib64/jvm/java-1.6.0-openjdk-1.2_b11/lib/tools.jar
> > Buildfile: build.xml does not exist!
> > Build failed
> >
> >
> > Any help greatly appreciated
> >
> > Chris
> -- Tavs bezmaksas pasts Inbox.lv