简体   繁体   English

java 命令在 linux 中抛出错误,但在 windows 中运行良好

[英]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.

相关问题 通过 Java 的 curl 命令适用于 Windows 而不是 linux - Curl command through Java works in windows and not in linux Linux上的Java SSL连接重置,Windows工作正常 - Java SSL connection reset on Linux, Windows works fine 从Java执行时,MYSQL命令给出错误。 相同的命令在Linux Terminal上可以正常工作。 可能是什么原因? - MYSQL command gives error while being executed from java. Same command works fine on Linux Terminal. What can be the reason? Java setShape()方法在命令提示符下给出错误,但在Eclipse上工作正常 - Java setShape() method giving error on command prompt but works fine on eclipse java代码搜索整个系统的文件,在windows上工作正常但在linux ubuntu中无限 - java code to search a file entire system, works fine on windows but infinite in linux ubuntu 当我尝试在Linux上运行程序时,程序抛出错误(在Windows上运行正常) - My program throws an error when I try to run it on Linux (works fine on windows) Java URLConnection适用于Windows,但不适用于Linux - Java URLConnection works with windows,but not with linux Java:Linux上的字体看起来很乱,但在Windows上很好 - Java: Fonts look garbled on Linux, but fine on windows Java ProcessBuilder返回退出错误128,在Linux中执行git(一些git命令可以正常工作) - Java ProcessBuilder returns exit error 128 executing git in linux ( some git command working fine ) 除了这个命令(合并)之外,ffmpeg大部分时间在java中工作正常,这个命令在终端中工作正常 - ffmpeg works fine most of the time in java except for this command (merging), and this command works fine directly in terminal
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM