Java package: Difference between revisions

512 bytes added ,  20 July 2012
No edit summary
Line 105: Line 105:


===Make sure that the build environment is configured properly===
===Make sure that the build environment is configured properly===
The installation process requires that the environment variable {{Codeline|JAVA_HOME}} points to the
The installation process requires that the environment variable {{Codeline|JAVA_HOME}} points to the Java Development Kit (JDK) on your computer.
Java Development Kit (JDK) on your computer.
*Note that JDK is not equal to JRE (Java Runtime Environment). The JDK home directory contains subdirectories with include, library and executable files which are required to compile the java package. These files are not part of the JRE, so you definitely need the JDK.
*Note that JDK is not equal to JRE (Java Runtime Environment). The JDK home directory contains subdirectories with include, library and executable files which are required to compile the java package. These files are not part of the JRE, so you definitely need the JDK.
*Do not use backslashes but ordinary slashes in the path. Set the environment variable {{Codeline|JAVA_HOME}} according to your local JDK installation. Please adapt the path in the following examples according to the JDK installation on your system. If you are using a Windows system that might be:
*Do not use backslashes but ordinary slashes in the path. Set the environment variable {{Codeline|JAVA_HOME}} according to your local JDK installation. Please adapt the path in the following examples according to the JDK installation on your system. If you are using a Windows system that might be:
:<pre>octave> setenv ("JAVA_HOME", "C:/Java/jdk1.6.0_21");</pre>
:<pre>octave> setenv ("JAVA_HOME", "C:/Java/jdk1.6.0_33");</pre>
:If you are using a Linux system this would look probably more like:
:If you are using a Linux system this would look probably more like:
:<pre>octave> setenv ("JAVA_HOME", "/usr/local/jdk1.6.0_21");</pre>
:<pre>octave> setenv ("JAVA_HOME", "/usr/local/jdk1.6.0_33");</pre>
:Note, that on all systems you must use the forward slash {{Codeline|/}} as the separator, not the backslash {{Codeline|\}}. If on a Windows system the environment variable {{Codeline|JAVA_HOME}} is already defined using the backslash, you can easily change this by issuing the following Octave command before starting the installation:
:Note, that on all systems you must use the forward slash {{Codeline|/}} as the separator, not the backslash {{Codeline|\}}. If on a Windows system the environment variable {{Codeline|JAVA_HOME}} is already defined using the backslash, you can easily change this by issuing the following Octave command before starting the installation:
:<pre>octave> setenv ("JAVA_HOME", strrep (getenv ("JAVA_HOME"), '\', '/'))</pre>
:<pre>octave> setenv ("JAVA_HOME", strrep (getenv ("JAVA_HOME"), '\', '/'))</pre>
*The Java executables (especially the Java compiler, javac) should be in the PATH. On Linux they're usually symlinked to from /usr/bin but on Windows that is usually not the case. If the Octave command:
:<pre>octave> system ('javac -version 2> nul')</pre>
:doesn't return zero (i.e., the command "javac -version" doesn't return normally), the command:
:<pre>octave> setenv ("PATH", [ JAVA_HOME filesep bin pathsep getenv("PATH") ])</pre>
:should do the trick. Watch out that 'getenv("PATH")' contains no spaces.


===Compile and install the package in Octave===
===Compile and install the package in Octave===
Anonymous user