Oztaco
Oztaco

Reputation: 3459

Get the name of a running Java program from C# (like the process name for .NET apps)

I need to get the name of the Java program thats being executed by Java, from a C# program. I have no access to the Java program (aka I'm not the one who wrote it, so I can't make it communicate with my C# program.) Is it possible to do this?

Upvotes: 1

Views: 842

Answers (2)

Marc
Marc

Reputation: 26

There is a command line tool that comes with the JDK called 'jps'. jps -v shows all the arguments you have passed to java.

You can call jps from c# and then read the output.

Hope this helps.

Upvotes: 1

Matt Westlake
Matt Westlake

Reputation: 3651

I don't know for sure, but I don't believe so and let me explain why:

on your root machine, if you use a process explorer you will just see the JVM (java virtual machine) and not what is happening inside it. the herarchy would actually be Root > Java VM > Java VM process. hope that logic helps you find your solution if there is one.

Upvotes: 0

Related Questions