Pergunta

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

Foi útil?

Solução

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.

Outras dicas

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...

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top