문제

If I try to open Notepad from a .NET console application it works fine. I'm doing it as follows:

var p = new Process
{
    StartInfo =
    {
        FileName = "c:\windows\system32\notepad.exe";
    }
};

p.Start();

When I try to open the application I actually want to open, nothing happens. If I open that application by hand I see a Java process being created, which means it's a Java application packaged as an exe file.

Any ideas on how to open Java exe apps through .NET?

Thanks in advance

도움이 되었습니까?

해결책

There shouldn't be much of a difference between a regular EXE and an "exified" Java application. Have you tried adjusting the working directory? Maybe there's some unzipping going on.

다른 팁

Lets say you had an application named "HelloWorld". Then from a command prompt (and from your code) you would launch it with:

java HelloWorld

Now this would assume that java is in your path. Which is a bad assumption. So you would be better off either having logic to populate the path to java, or to hardcode it.

I don't ever recommend hardcoding a path if you plan to pass this software around. It's never a sure thing...

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top