Samstag, 21. August 2010

Howto install jhandles in octave 3.2 with ubuntu 10.04


Last evening I joined a discussion on the GNU Octave mailing list about a problem making jhandles work on the current ubuntu. I already succeeded with that on my own machine with octave 3.2.4 and opensuse 11.3 64 bit, so I thought it will work on ubuntu too and gave it a try in a virtual machine.

Ok so I did it with 32 bit ubuntu 10.04 in vmware player (had no chance to do it with 64 bit so please take care that some paths can be slightly different on 64 bit version):

Install the following packages in ubuntu

sudo apt-get install octave3.2 octave3.2-headers
sudo apt-get install openjdk-6-jre openjdk-6-jdk
sudo apt-get install libjogl-java
sudo apt-get install mesa-common-dev

The following symbolic links are a workaround to make the configure scripts of the installer find the packages and there may be better solutions, but at least it works.

cd /usr/lib
sudo cp -s /usr/lib/mesa/libGL.so.1 libGL.so

cd /usr/bin

sudo cp -s /usr/share/java/jogl.jar .
sudo cp -s /usr/share/java/gluegen-rt.jar .

Download the octave java package 1.2.7 from octave forge
Download jhandles 0.3.5 from octave forge.

Extract the jhandles package and navigate to the src folder. Open the configure script with an editor of your choice.
In the lines 4335, 4337, 4341 and 4342 change

octave -qf

to

octave -q

Save the file.

(Delete only the character f make sure you do not change anything else, do not delete the character ` at the end of the lines).
Change into the folder where you downloaded this packages for example

cd ~/Downloads

Run octave as root to install the packages system wide

sudo octave

Then proceed in octave

setenv("JAVA_HOME", "/usr/lib/jvm/java-6-openjdk")

pkg install -verbose java-1.2.7.tar.gz

(you will get some compiler warnings which can safely be ignored)

check that the functions from the java package are really available and work.

help java_new
type java_new
x = java_new ("java.lang.StringBuffer", "Initial string")
x.toString()

None of these commands should give error messages. So at this point you have the java binding s successfully installed.

Let's proceed with jhandles:

pkg install -verbose jhandles-0.3.5

ignore the warnings and exit octave.

Add the following lines to your .octaverc file with an editor of your choice in your home directory (create this file if there is none) before you proceed.

javaaddpath("/usr/share/java/gluegen-rt.jar")
javaaddpath("/usr/share/java/jogl.jar")


Now start octave as normal user

The command pkg list should now show

java *| 1.2.7 | /usr/share/octave/packages/3.2/java-1.2.7
jhandles | 0.3.5 | /usr/share/octave/packages/3.2/jhandles-0.3.5

Test the jhandles functionality with the following code snippet:

pkg load jhandles
sombrero
shading interp


Hopefully it works also for you.

6 Kommentare:

  1. Hi Martin,

    Thanks a bunch for the installation instructions. I am am attempting to use jhandles on Ubuntu 9.10. Using your instructions I was able to install jhandles. But when I run >sombrero from octave I get the following error:

    error: [java] javax.media.opengl.GLException: java.lang.IllegalArgumentException: Illegally formatted version identifier: "null"
    error: called from:
    error: /usr/share/octave/packages/3.2/jhandles-0.3.5/drawnow.m at line 22, column 7

    I followed your instructions exactly except for the symbolic link of /usr/lib/mesa/libGL.so.1. On my system this file does not exist (in fact, the /usr/lib/mesa/ directory does not exist). I do have mesa-common-dev installed. Maybe this is a subtle difference between Ubuntu 9.10 and 10.04?

    Any ideas for a fix?
    Thanks,
    Adam

    AntwortenLöschen
  2. Hello, thank you for providing the instruction on your blog. I followed up to the line: pkg install -verbose jhandles-0.3.5, but I still get Error 255 (no java). Everything else works up to that point. I would appreciate any pointers (I am still new, running ubuntu 10.04 (32bit) via Parallels 5, on Mac OSX 10.6.) Thank you in advance. Happy holidays...

    AntwortenLöschen
  3. Works fine. Had the same error as "Anonym" but second time the JAVA_HOME I set correct and it worked. Thanks.

    AntwortenLöschen
  4. Hi Martin,

    I tried to install java-1.2.7. After I see java in pkg-list, but I cannot use it:

    octave:9> help java_new
    error: help: `java_new' not found

    It seems, there is something wrong with some path specifications:

    octave:16> pkg load java
    warning: addpath: /home/shille/octave/java-1.2.7: No such file or directory

    octave:12> ls /home/shille/octave/
    ans =

    octave:15> ls /usr/share/octave/packages/3.2
    java-1.2.7 octave_packages

    Do you know how could I change the path for java octave is looking for?

    Cheers, Siggi.

    AntwortenLöschen
  5. tested with java-1.2.8, you should add parameter "-qf" to configure in jhandles-0.3.5/src directory, line 3045.

    OCTAVE_VERSION=`echo "disp(OCTAVE_VERSION)" | $OCTAVE -qf`

    AntwortenLöschen
  6. Hello, I did the recipe and ended up with the following error:

    octave:9> pkg install -verbose jhandles-0.3.5
    make: *** [all] Error 255
    'make' returned the following error: make: Entering directory `/home/arash/Downloads/jhandles-0.3.5/src'
    Java support not compiled
    make: Leaving directory `/home/arash/Downloads/jhandles-0.3.5/src'
    error: called from `pkg>configure_make' in file /usr/share/octave/3.2.3/m/pkg/pkg.m near line 1253, column 2
    error: called from:
    error: /usr/share/octave/3.2.3/m/pkg/pkg.m at line 714, column 5
    error: /usr/share/octave/3.2.3/m/pkg/pkg.m at line 287, column 7

    Do you have any idea what goes wrong?

    AntwortenLöschen