0
$\begingroup$

Rosanswers logo

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

http://code.cs.tum.edu/indefero/index.php//p/client-rosjava/source/tree/86a8ff29ecda2204271fd08838a047e5ebcedc72/rosjava/scripts/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.


Originally posted by Kei Okada on ROS Answers with karma: 1186 on 2011-07-01

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by Lorenz with karma: 22731 on 2011-07-03

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Lorenz on 2011-07-16:
Please have a look at the roslaunch documentation (www.ros.org/wiki/roslaunch). In short:

Comment by ubuntuslave on 2011-07-16:
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!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.