gpt4 book ai didi

java - 从 ASP.NET MVC 运行 Java 不起作用

转载 作者:行者123 更新时间:2023-12-02 13:27:07 27 4
gpt4 key购买 nike

当我尝试从 cmd 运行 Java 代码时,它可以工作。但是当我从 ASP.NET MVC 应用程序运行它时,我总是得到:无法找到或加载主程序。这是我正在使用的代码:

Process p = new Process();
p.StartInfo.FileName = "C:/Program Files/Java/jdk1.8.0_20/bin/java.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.Arguments = "E:/Atypon/TE1/src/Assignment3.DateTest";
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.RedirectStandardError = true;
p.Start();
string result = p.StandardError.ReadToEnd();
p.WaitForExit();

我做错了什么?

最佳答案

类名的参数是否错误,也许应该是

p.StartInfo.Arguments = "E:/Atypon/TE1/src/Assignment3.DateTest.class"; 

What does "Could not find or load main class" mean?

关于java - 从 ASP.NET MVC 运行 Java 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43350595/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com