[英]java command throwing an error in linux although works fine in windows
I am trying to run my java program through bash in a linux system where the command is:我正在尝试在 linux 系统中通过 bash 运行我的 java 程序,命令为:
java -Dresources=path1 -Dinstance=instance1 -cp ./lib/jar1.jar;./lib/folder1/*;./lib/common/*; lib/folder2/* com.test.host
In the host class I am reading some XML files, which has spring beans and I am loading them.在主机 class 中,我正在读取一些 XML 文件,其中包含 spring 个 bean,我正在加载它们。 This command works perfectly fine in windows. However, when I run this in Bash shell. I get the following exception:
此命令在 windows 中运行良好。但是,当我在 Bash shell 中运行此命令时,出现以下异常:
syntax error near unexpected token newline 'xml version= 1.0 encoding= utf-8'
意外标记换行符'xml version= 1.0 encoding= utf-8'附近的语法错误
I tried removing unnecessary spaces in the XML and tried but to no avail.我尝试删除 XML 中不必要的空格并尝试但无济于事。
As @MarkRotteveel mentioned, after replacing;正如@MarkRotteveel 提到的,替换后; (semi-colon) with the: (colon), the command works as intended.
(分号)与:(冒号),命令按预期工作。 However, I am not sure why did java not detect the error with the usage and threw an error/exception
但是,我不确定为什么 java 没有检测到使用错误并抛出错误/异常
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.