tags:

views:

181

answers:

2

Hi, I have created a simple java networking program. I am using Fedora. whenever I want to see what the processes run on my system I found that for my application the process Name is java. I want give process name for my application. How to give process name.

Thanks Sunil Kumar Sahoo

+2  A: 

One way to change the process name of an application is to use a native launcher (or to copy the java/java.exe executable to another name).

Personally I've had good results with Launch4j

Joachim Sauer
I think launch4j will not work for linux. its for windows
Deepak
can i do it by myself?
Deepak
A: 

You could pass a java property to the jvm when you start the process then that should show up when running a ps -eaf and you could even do a ps -eaf|grep myprop to see if it's running.

so you start the app like this:

java -cp . com.whatever.MyApp -DMyAmazingProgram=true

then you should see the MyAmazingProgram=true in the ps output.

Another way would be to start your app from a bash script file e.g, startMyAmazingApp.sh then that should show up in the ps output until the process ends.

That script would have to not exit until the java process finished so you'd need to have a script a bit like this (rough guess):

#!/bin/bash
RESULT=`java -cp com.whatever.MyApp`

HTH

simonlord