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 shell script?
有人可以帮我这个吗?我有一个.jar文件,我写了一个批处理文件(代码如下所示)。如何创建等效的shell脚本?
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
1 个解决方案
#1
0
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.
我不熟悉Windows上的脚本(我推断你从反斜杠使用Windows。),但我认为无论如何我都会提供以下内容。这应该适用于Unix / Linux工作系统。这是一个bash脚本。
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
#1
0
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.
我不熟悉Windows上的脚本(我推断你从反斜杠使用Windows。),但我认为无论如何我都会提供以下内容。这应该适用于Unix / Linux工作系统。这是一个bash脚本。
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