Can anyone please help me with this? I've got a .jar file for which I wrote a batch file (code is shown below). How do I create an equivalent shel开发者_JAVA技巧l script?
SETLOCAL ENABLEDELAYEDEXPANSION
set BUILD_LIB_DIR=lib
set CLASSPATH=.
for %%f in (%BUILD_LIB_DIR%\*.jar)do set CLASSPATH=!CLASSPATH!;%%f
java -client -cp %CLASSPATH% -jar -Dport=7000 MyJar.jar
ENDLOCAL
Thanks
I'm not familiar with scripting on Windows (I infer you are using Windows from the backslash.), but I thought I'd offer the following anyway. This should work on a Unix/Linux workalike system. It is a bash script.
Create script file with following content and make it executable:
#!/bin/bash BUILD_LIB_DIR=lib CLASSPATH=. for f in $BUILD_LIB_DIR/*.jar; do CLASSPATH="$CLASSPATH;$f" done java -client -cp $CLASSPATH -jar -Dport=7000 MyJar.jar
精彩评论