开发者

Process management in java

开发者 https://www.devze.com 2023-03-20 22:13 出处:网络
My problem is with the management processes in Java. Yesterday I wrote the question, but unfortunately the post was closed.

My problem is with the management processes in Java.

Yesterday I wrote the question, but unfortunately the post was closed.

[Process management in java closed]

Today I can tell y开发者_如何学JAVAou a little more. the problem is that, in terms of standard functions java processes are started very slowly, and not that things are done too disastrously slow.

for example, in C# code

    Process proc = new Process();
    proc.StartInfo.FileName = "D://xp.exe";
    proc.StartInfo.Arguments = args[0] + " " + args[1];
    proc.StartInfo.WorkingDirectory = Environment.CurrentDirectory;
    proc.Start();

For example, the C # code runs quickly and as needed.

Can advise those third-party library?

Yes, this information may be small, but can someone encountered this problem.


Why can't you just use the Runtime class of the Java Standard Edition? It seems to do exactly what you need and the syntax is somewhat similar to the C# code you have shown us here. Have a look at the exec function which takes exactly the same three parameters you are giving to the C# Process.

I have no idea what you mean by:

Today I can tell you a little more. the problem is that, in terms of standard functions java processes are started very slowly, and not that things are done too disastrously slow.

If the only thing you want to do in the Java program is to start other processes, then it does not make sense to use Java at all.


If what you want is to execute a command using Java you do it this way:

    String command = "D://xp.exe";
    String[] arguments = {"firstArgument", "secondArgument"};
    Runtime.getRuntime().exec(command, arguments);

Take a look at Runtime.

0

精彩评论

暂无评论...
验证码 换一张
取 消