Joshhw
Joshhw

Reputation: 202

converting a batch file to shell script (multiple jars on Mac)

My shell scripting knowledge is minimal. So I'm trying to convert the following:

@set CLASSPATH=".;.\resources\;.\lib\jboss-client.jar;.\lib\jfxtras-labs-2.2-  r4.jar;.\lib\jfxrt.jar;.\lib\icecile.jar;"

echo CLASSPATH: %CLASSPATH%
".\jre7\bin\java" -classpath %CLASSPATH% com.ent.thing.icecile.ui.icecile

so this is what I wrote

#!/bin/sh

export CLASSPATH=/resources:/lib/jboss-client.jar:/lib/jfxtras-labs-2-r4.jar:/lib/jfxrt.jar:/lib/icecile.jar

echo CLASSPATH: $CLASSPATH
"java" -classpath $CLASSPATH com.ent.thing.icecile.ui.icecile

Im using a Mac computer and I've been glossing over some documentation but this doesn't want to run for me. Any help would be great

Upvotes: 0

Views: 32

Answers (1)

iamtheib
iamtheib

Reputation: 204

The first thing I can see wrong with your script is that, you're using absolute paths in your classpath. While this is not wrong, I doubt it is what you want. So, using relative paths (./) instead of absolute path (/), should solve one of your problems.

Try:

#!/bin/sh

# You don't need to 'export' unless you want the variable to exist
# outside of your script
CLASSPATH=".:./resources:./lib/jboss-client.jar:./lib/jfxtras-labs-2-r4.jar:./lib/jfxrt.jar:./lib/icecile.jar"

echo CLASSPATH:$CLASSPATH
java -classpath $CLASSPATH com.ent.thing.icecile.ui.icecile

Upvotes: 2

Related Questions