我有这个脚本:

#! /bin/bash -

# ENVIRONMENT VARIABLES

JDK_PATH="C:\Program Files\Java\jre1.8.0_151\bin\java"
WEKA="C:\Program Files\Weka\weka-3-4\weka.jar"

# ----------------------------------

COMMONS_CLI=./lib/commons-cli-1.0.jar
MRC=./lib/jmrc.jar

LIBS=.:$WEKA:$COMMONS_CLI:$MRC:bin/

$JDK_PATH -Xmx512m -classpath $LIBS recognizer.PersonalityRecognizer $*


来自this项目

我尝试在git bash命令行中运行此命令

./PersonalityRecognizer -i ../output_dir -d -t 2 -a ../mairesse_Apache.arff


但是我收到此错误:

$ ./PersonalityRecognizer -i ../output_dir -d -t 2 -a ../mairesse_Apache.arff
./PersonalityRecognizer: line 15: C:\Program: No such file or directory


Java路径中的空格字符有问题吗?如何正确编写

最佳答案

您的命令应为:

"$JDK_PATH" -Xmx512m -classpath "$LIBS" recognizer.PersonalityRecognizer $*


ot bash会将空格视为分隔符,而不是路径的一部分

10-06 02:20