0

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

2
  • What is the error please? Commented Jul 27, 2016 at 16:15
  • Cannot find main class. Does this structurally look correct? Commented Jul 27, 2016 at 16:17

1 Answer 1

2

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
Sign up to request clarification or add additional context in comments.

3 Comments

this did the trick for me. Could you possibly tell me what the echo CLASSPATH:$CLASSPATH actually does? I had to transfer this but my scripting skills are beginner level.
@Joshhw - it displays the word CLASSPATH, followed by a colon, followed by the contents of the variable $CLASSPATH.
echo in shell is just like echo in batch scripts or print in other languages, and it's mostly used so the programmer can see what is going on. That line is basically saying, print out the literal CLASSPATH: followed by the value in my CLASSPATH variable

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.