user3002384
user3002384

Reputation: 45

Hide Process Command Line

In Java, you can execute a process and pass command line arguments to it via Runtime.getRuntime().exec().

The arguments you passed into the program can be seen in the task manager or the process explorer. I want to know if there is a way to hide or clear that command history, so that it can be seen by neither.

Any help is appreciated.

Upvotes: 3

Views: 1028

Answers (1)

Ben Barkay
Ben Barkay

Reputation: 5622

You cannot hide the process or the full command that started it. Whatever you pass as command to Runtime#exec will show and there is no way around it.

Your alternatives are:

  • Integrate the functionality into your application instead of starting a new process. If it's your own native code, you can use JNI to run it. If not your code, you can look for a Java library that does what it does. This is what I would recommend.
  • Pass the arguments via IPC (stdin/out, tcp, etc..).
  • Read the arguments from a temporary configuration file that will be deleted once the process starts.

Upvotes: 1

Related Questions