-1

我在 .bat 中有以下代码,它在 Windows 上运行良好

* @java -classpath ..\QVDReader.jar;..\lib\opencsv-2.3.jar;..\lib\jdbm-3.0-SNAPSHOT.jar -Dfile.encoding=UTF-8 ExampleQVDReader .\QVD\Customer. qvd .\CSV\Customer.csv ";" 暂停 *

总结,它是一个库,可以将 QVD 文件转换为 CSV(没有问题)。但是当我想在 Centos 服务器中尝试它时,在终端中它是错误的,我不知道为什么,我使用了这个

java -classpath ../QVDReader.jar;../lib/opencsv-2.3.jar;../lib/jdbm-3.0-SNAPSHOT.jar -Dfile.encoding=UTF-8 ExampleQVDReader ./QVD/Customer.qvd 。 /CSV/Customer.csv ";"

我需要在 Linux 中执行相同的操作,有什么想法吗?

问候。

4

1 回答 1

0

You don't mention what shell you're using, but I'll assume it's an sh variant, in which semicolons ; are special characters that separate commands. So:

java -classpath ../QVDReader.jar;../lib/opencsv-2.3.jar;../lib/jdbm-3.0-SNAPSHOT.jar -Dfile.encoding=UTF-8 ExampleQVDReader ./QVD/Customer.qvd ./CSV/Customer.csv ";"

Is broken up into multiple commands at each semicolon, to this:

java -classpath ../QVDReader.jar
../lib/opencsv-2.3.jar
../lib/jdbm-3.0-SNAPSHOT.jar -Dfile.encoding=UTF-8 ExampleQVDReader ./QVD/Customer.qvd ./CSV/Customer.csv ";"

To treat the semicolons literally, put the argument in single quotes:

java -classpath '../QVDReader.jar;../lib/opencsv-2.3.jar;../lib/jdbm-3.0-SNAPSHOT.jar' -Dfile.encoding=UTF-8 ExampleQVDReader ./QVD/Customer.qvd ./CSV/Customer.csv ';'

You can use double-quotes too, but be aware of the differences.

于 2018-12-09T03:46:08.077 回答