无法访问jar文件 [英] Unable to access jar file

查看:205
本文介绍了无法访问jar文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须通过TCP访问java程序C#程序。在我的C#程序,我用这行代码启动Java程序:

I have a c# program that access a java program by tcp. In my C# program I'm starting the java program by this line of code:

var process = new Process
{
  StartInfo =
  {
      UseShellExecute = false,
      CreateNoWindow = false,
      FileName = "cmd.exe",
      Arguments = (@"/c java -ms16m -mx512m -jar pathToJavaApp/javaApp.jar 3562")
  }
};

这工作正常,我没有任何问题,直到如今。我安装我的一位同事的电脑程序。现在我得到的错误:无法访问的jar文件。

This works fine I had no problems until now. I've installed my program on a colleague's computer. Now I'm getting the error: Unable to access the jar file.

于是我在命令行中尝试Java的罐子javaApp.jar和javaApp将立即启动。

So I tried in command line "java -jar javaApp.jar" and the javaApp starts immediately.

我试图启动程序以管理员身份,同样的错误。 (Windows Vista中)

I tried starting the program as administrator, same error. (windows vista)

有关的那一刻,我不知道这个问题可能是。

For the moment I have no idea what the problem could be.

推荐答案

我的猜测是,路径jar文件包含空格。你需要引用它。例如:

My guess is that the path to the jar file contains spaces. You'll need to quote it. For example:

Arguments = "/c java -ms16m -mx512m -jar \"" + pathToJavaApp 
    + "\"/javaApp.jar 3562"

这篇关于无法访问jar文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆