Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Ensure single instance of Java application

807580Aug 4 2010 — edited Nov 4 2010
Hi,

I'd like to make sure that only one instance of my Java application can be run and I've done some search around. The recommended approach seems to be using ServerSocket that occupies a certain port.

On the other hand I've seen that JConsole could display the names of all Java processes that are running. This is perhaps another approach to the issue? JConsole is said to be a pure Java tool, so I was wondering how this is implemented. I've googled a bit but still could not find out how. Could someone please give me a hint?

Thanks a lot!

Comments

That isn't a java or jni question.

There is nothing magic in java/jni that allows/prevents that.

You should create a test app that has no java/jni in it and figure out how to dynamically load a dll (presumably what you are doing.)  A windows programming site can help with specifics.

As a suggestion I would suggest that you do the following since it will help debugging problems.

1. Determine the fully qualified path to the dll

2. Use that

3. If the dll fails to load then report that fully qualified path.

1 - 1
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Dec 2 2010
Added on Aug 4 2010
22 comments
12,774 views