Renaming a process in java

R

Rajesh Patel

I would like to have a name other than java.exe show up in the
processlist. Is there a way to change this name programatically.
Doing it with JNI would be fine with me.

Raj
 
H

hilz

Rajesh Patel said:
I would like to have a name other than java.exe show up in the
processlist. Is there a way to change this name programatically.
Doing it with JNI would be fine with me.

Raj


how about creating a C program and use the _execl() function which executes
the command that starts the jvm and launches your application. Then, create
the exe file from your C code, and the name of this exe will appear in the
task list.

you can even make this executable read a configuration text file and pass
its text as arguments to the launching command, so that you do not need to
recompile the C program everytime you make changes to the command line
arguments.

HTH
hilz
 
C

Chris Uppal

Rajesh said:
I would like to have a name other than java.exe show up in the
processlist. Is there a way to change this name programatically.
Doing it with JNI would be fine with me.

You might be able to get away with just renaming java.exe, but I've never tried
that.

Otherwise, you could write your own launcher to replace java.exe.

The source for java.exe is included in the J2SDK and is covered (I believe) by
a license specifically relaxed in order to allow you to create and ship
modified
versions.

The launcher itself is just a simple bit of JNI programming.

-- chris
 
L

Larry Barowski

hilz said:
how about creating a C program and use the _execl() function which executes
the command that starts the jvm and launches your application. Then, create
the exe file from your C code, and the name of this exe will appear in the
task list.

I assume the OP was talking about Windows. This won't work in Windows
since execl() is "fake" - it just creates a new process and ends the parent.
There seems to be no good way to overlay a process in Windows.
 
D

Dave Monroe

Rajesh Patel said:
I would like to have a name other than java.exe show up in the
processlist. Is there a way to change this name programatically.
Doing it with JNI would be fine with me.

Raj

If you're using unix, you could create a symbolic link.
 
D

Dave Monroe

Rajesh Patel said:
I would like to have a name other than java.exe show up in the
processlist. Is there a way to change this name programatically.
Doing it with JNI would be fine with me.

Raj

If you're using *nix you could create a symbolic link to java.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top