Ask Your Question
1

how to set JAVA_HOME in launch file?

asked 2011-07-01 17:09:30 -0600

Kei Okada gravatar image

I'd like to set JAVA_HOME environment variable from find-java-home.sh program

http://code.cs.tum.edu/indefero/index...

  < node name="json_prolog" pkg="json_prolog" type="json_prolog"
        args="jsk_semantic_maps"
        launch-prefix='JAVA_HOME=`rosrun rosjava find-java-home.sh`'
        />

produces following error

Roslaunch got a 'No such file or directory' error while attempting to run:

JAVA_HOME=`rosrun rosjava find-java-home.sh` /home/k-okada/ros/diamondback/knowrob-trunk/json_prolog/bin/json_prolog jsk_semantic_maps __name:=json_prolog __log:=/home/k-okada/.ros/log/240f00c8-a37e-11e0-9734-005056c00001/json_prolog-2.log

Please make sure that all the executables in this command exist and have
executable permission. This is often caused by a bad launch-prefix.

but

roslaun jsk_semantic_maps example-eng2-map.launch --args /json_prolog | bash

works.

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2011-07-03 02:10:51 -0600

Lorenz gravatar image

updated 2011-07-03 21:50:52 -0600

I'm not sure if it is possible to use $() or `` inside roslaunch since it is actually bash syntax and I guess roslaunch just uses python. Instead, I suggest a different solution, something like a wrapper script to run something with JAVA_HOME set correctly. The script could look like this:

#!/bin/bash
export JAVA_HOME=$(rosrun rosjava find-java-home.sh)
exec $@

Then use it as launch-prefix for your node. If you have it working and want it to be added to the rosjava package, please drop me an email.

edit flag offensive delete link more

Comments

How would you tell the launch file to execute the script? I guess the question is: How to use the "launch-prefix" for the node. Thanks in advance!
ubuntuslave gravatar imageubuntuslave ( 2011-07-16 04:32:02 -0600 )edit
Please have a look at the roslaunch documentation (www.ros.org/wiki/roslaunch). In short: <node name="foo" pkg="bar" type="baz" launch-prefix="$(find foo)/with_java_home.sh"/>
Lorenz gravatar imageLorenz ( 2011-07-16 08:15:58 -0600 )edit
0

answered 2011-07-02 21:21:44 -0600

Does running rosrun rosjava find-java-home.sh work? And if you do a roscd rosjava, does find-java-home.sh exist somewhere in the directory you get to?

The version of rosjava that you are using has recently been renamed to rosjava_jni; perhaps you have installed the new rosjava in parallel, and ROS tries to find your script in the wrong package.

edit flag offensive delete link more

Comments

Just a quick note: rosjava hasn't really been renamed yet, only the corresponding wiki page. But at least the debian package will probably be renamed soon :)
Lorenz gravatar imageLorenz ( 2011-07-03 02:12:24 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2011-07-01 17:09:30 -0600

Seen: 461 times

Last updated: Jul 03 '11