简体   繁体   English

在Linux环境中运行Java应用程序时出现问题

[英]Issue while running a java application in Linux env

I have a java project built in eclipse in my Windows machine. 我在Windows计算机中的Eclipse中内置了一个Java项目。 Now i had to run it in Linux machine. 现在我不得不在Linux机器上运行它。 I created a jar , and i am trying to run the jar. 我创建了一个jar,我正在尝试运行该jar。

The main class, takes a XML file as input. 主类将XML文件作为输入。 Previously on Windows, i had given path of the file in Windows. 以前在Windows上,我已经在Windows中给出了文件的路径。 Now i kept the .xml file in the root location in Unix. 现在,我将.xml文件保留在Unix的根目录中。

can i modify the code in Windows, to the root path of Linux machine and try to run the jar. 我可以将Windows中的代码修改到Linux机器的根路径并尝试运行jar。

I did it like this , 我是这样做的

XYZ parsero = new XYZ("//root//workflow.xml");

Created the jar and tried to run in Unix. 创建了jar并尝试在Unix中运行。

I got the below exception. 我得到以下异常。

java.net.UnknownHostException: root

How do i need to run this. 我需要如何运行它。

I got the solution. 我找到了解决方案。 It should be XYZ parsero = new XYZ("/root/workflow.xml"); 它应该是XYZ parsero = new XYZ(“ / root / workflow.xml”); unlike in Windows 与Windows不同

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM