StefanLindel / codeswarm

Automatically exported from code.google.com/p/codeswarm
GNU General Public License v3.0
0 stars 0 forks source link

run.sh does not work from /usr/local/bin or equivalent #60

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. Install codeswarm into /usr/local/share or equivalent
2. Install or symlink run.sh from /usr/local/bin or equivalent
3. Run codeswarm

What is the expected output? What do you see instead?

Codeswarm should run, fails to find jar 

"ERROR, please verify 'ant' and 'java-sdk' installation" 

What version of the product are you using? On what operating system?

Latest trunk 

Patch attached to resolve this. Used the code from the ant project's launcher 
script 
(ANT_HOME/bin/ant). Not sure if that causes a license problem? Also only tested 
on OS X.

Cheers,

Matt

matth@macbook matth$ svn diff run.sh 
Index: run.sh
===========================================================
========
--- run.sh  (revision 273)
+++ run.sh  (working copy)
@@ -1,9 +1,25 @@
 # run.sh : code_swarm launching script
 # need the config file as first parameter

+## Get codeswarm dir, resolving symlinks
+PRG="$0"
+progname=`basename "$0"`
+
+# need this for relative symlinks
+while [ -h "$PRG" ] ; do
+  ls=`ls -ld "$PRG"`
+  link=`expr "$ls" : '.*-> \(.*\)$'`
+  if expr "$link" : '/.*' > /dev/null; then
+  PRG="$link"
+  else
+  PRG=`dirname "$PRG"`"/$link"
+  fi
+done
+
+codeswarm_dir=`dirname $PRG`
 params=$@
-default_config="data/sample.config"
-code_swarm_jar="dist/code_swarm.jar"
+default_config="$codeswarm_dir/data/sample.config"
+code_swarm_jar="$codeswarm_dir/dist/code_swarm.jar"

 # command line parameters basic check
 if [ $# = 0 ]; then
@@ -48,7 +64,7 @@
 fi

 # running
-if java -Xmx1000m -classpath 
dist/code_swarm.jar:lib/core.jar:lib/xml.jar:lib/vecmath.jar:. 
code_swarm $params; then
+if java -Xmx1000m -classpath 
$codeswarm_dir/dist/code_swarm.jar:$codeswarm_dir/lib/core.jar:$codeswarm_dir/li
b/xml.jar:$
codeswarm_dir/lib/vecmath.jar:$codeswarm_dir:. code_swarm $params; then
 # always on error due to no "exit buton" on rendering window
     echo "bye"
 #    echo -n "error, press a key to exit"

Please provide any additional information below.

Original issue reported on code.google.com by monsieur...@gmail.com on 26 Apr 2009 at 9:34

GoogleCodeExporter commented 8 years ago
On Ubuntu 10.04, I changed JAVA_HOME to
export JAVA_HOME=/usr/lib/jvm/java-6-sun/
to make it work

Original comment by ywarn...@gmail.com on 8 Sep 2010 at 9:47