Detecting another JVM instance

I have developed a Java desktop application that works fine if there is only one instance of it running. When a second instance of it is opened, problems occur. Is there any way to detect that another instance of an application (or JVM) is currently running? If I could detect this, I could display a message informing the use that they already have an instance running and to close one of them...
Any guidance here would be greatly appreciated.

Traditionally done
-with a ServerSocket bound to a specific port
-with a lock file (on *nix often with the pid).                                                                                                                                                                                                                                                           

Similar Messages

  • Calling a method in another JVM instance

    I know you can use RMI to call the methods from classes across the network, but if the class is on the same machine, just in another JVM instance, is there a way to bypass the network layer and have the JVMs communicate directly with each other?

    Its not so much the overhead, as having the
    flexibility, to not have to modify firewall rules
    which disallow loop back traffic and most other non
    http (port 80) traffic if the production server is
    set up that way.You're coding to interfaces anyway, have a factory return either an RMI object which does the actual RMI work, or just a vanilla one if you're just running locally. As far as I know, there isn't a way to entirely circumvent the socket layer with RMI. Anyone know any different?

  • Certain application's JVM instance

    Hello,
    I didn't really know in what section to post this thread, so I figured this was the best one. If it is in the wrong section, notify me, and I will post it in the correct section.
    I am making an application in C which requires getting the process ID of a specific JVM instance. The problem isn't getting the process ID, but it's differentiating a VM instance from another. How would I go upon doing this?
    Thanks

    Wow! Can't get much easier than that :)
    Thanks alot!
    EDIT: The application I am trying to get runs as an applet. So unfortunately, every applet prints: sun.plugin2.main.client.PluginMain
    Any ideas?

  • How to Shutdown JVM Instance

    I have a java program which I start(run) from console, the program acts as a listener so it never exits, however I want to be able to it shutdown by running a batch file or running a script which is basically in another console window, any ideas how can I shutdown a JVM instance from another console window.
    *Note: Pressing <Ctrl+C> in the application console is not an option.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Maybe have a socket listener on a certain tcpip port.
    Then send a message to that tcpip port... one which your original app will interpret as a "shutdown" signal.....
    regards,
    Owen

  • Possible to create a pool of JVM's from another JVM's ?

    Hi all,
    currently I'm researching on a small task where a native "black box" C++ library needs to be integrated into Java, developing some kind of JNI-based wrapper. I've done this already with SWIG two times before, worked quote well, but this time it's different: The wrapper will be used from a multiuser application (i.e. various parallel working calls) but the native library is not only not threadsafe, but it also utilises static variables at central places.
    My idea is the follwing
    1) The standard solution part: create a wrapper application in it's own JVM which exposes the native interfaces as Java interfaces
    2) Instantiate multiple of these wrappers as separate processes (i.e.: separate JVMs, the "inside JVM") from another JVM ("outside JVM").
    3) The outside JVM uses the multiple instances in a kind of "round-robin" or "next free" pattern to assign new calls to a set of "worker JVM".
    The interesting part of this question is in 2): How can I instantiate a [set of] new JVM from inside another JVM so the inside JVM are really their own processes? Only by having the multiple instances as separate processes I can overcome the problem of the single-threaded native lib becoming "quasi-multithreading"?
    The easiest approach would be likely to start new JVMs using the "Process" object and to start new JVMs with the usual shell scripts. But I'd like to have some more elegant ,-)) Is there any way to have this done in a better way?
    Thanks a lot,
    Soeren Gerlach

    Presumbly locking wouldn't work?Not really: Locking would mean that only one client/person could use the library using the Java wrapper. That in fact is the shortcoming I'd like to overcome by instantiate multiple processes.
    Thanks,
    Soeren

  • Automatic Sales order creation from IDOC generated in another SAP instance?

    Hi,
    I have been trying to create Sales ordes in a seperate SAP instance, through the Purchase order generated in another Instance.
    The Purchase order generated, passes the informtion through an IDOC to another SAP instance, I am getting the following error
    " VKORG, VTWEG, SPART cannot be determined for customer 0000001000 ,Vendor000200038 "  
    It is Message No VG204 , Status Record 51
    Please help to solve the problem.
    Regards,
    Chamandeep

    SAP Xpert friends,
    I really need help in figuring out this error I get when I send an IDoc from external system to SAP.
    Here is what I do....
    create empty idoc of type ORDERS01
    idoc.MESTYP = "ORDERS";
    idoc.SNDPRN = "1171";
    idoc.SNDPRT = "KU";
    idoc.MANDT = "400";
    idoc.SNDPFC = "AG";
    idoc.MESCOD = " ";
    idoc.MESFCT = " ";
    idoc.TEST = " ";
    create segment of type E1EDK01
    add field MENGE with a value
    add segment e1edp01  to idoc
    create segment of type E1EDP19
    add field QUALF with a value to segment
    add field IDTNR  with a value to segment
    add segment E1EDP19 to idoc
    send idoc
    When I check WE02 in SAP, I can see the idoc, but
    get this error
    Here are all the STATUS RECORDS
    <b>50  IDoc added
    64  IDoc ready to be transferred to application
    62  IDoc passed to application
    51  Error: Application document not posted
        <i>VKORG, VTWEG, SPART cannot be determined</i>
        for customer 0000001171 , vendor</b>
    I checked on Internet and found that VOE2 can be used to setup ... this is what I have in VOE2
    Customer    Vendor  SOrg     DChl   Dv
    1171        0000001171       1000   00
    Thanks for help...

  • My iPhone's bluetooth is not able to detect another iPhone iOS 7.0.6. (latest)

    my iPhone's bluetooth is not able to detect another iPhone iOS 7.0.6. (latest)

    Speakers, keyboards, headsets, pulse monitors, pebble watches, cars with hands free systems, etc.
    Are both phones signed into itunes under the same user?
    are you trying to transfer purchased music to someone else in violation of itunes terms of service?

  • Multiple JVM instances

    Dear all,
    I am trying to create multiple JVM instances using createJavaVM(...) but I can't do it. When I try to create the second instance, the function returns an error.
    Does anybody know about getting multiple JVM instances running??
    Thanks in advance,

    Hallo,
    createJavaVM(...) trys to create a JVM in your current
    process, so I am not surprised that you get an error
    the second time round, because there is already a JVM
    in the process. If you want multiple JVMs, each needs
    to be in its own process.
    Why do you want to create more than one JVM in your
    process? The JVM is multithreadable, and you can start
    more than one thread in the JVM. Would that do what
    you want?I need multiple instances because my application needs nearly 2Gb of memory and the maximum heap I get is 1700 Mb. I think with multiple instances, I'll get it.
    Do you know about getting a bigger heap??
    >
    David Singleton
    [email protected]

  • Regarding code to call & control a  JVM from another JVM

    hi,
    I need to communicate from one JVM to another JVM. I know it can be done using RMI. But, i don't to write in code.If any one had tried it, please reply me with the code.
    Satchi

    Hi Satchi,
    In my opinion, RMI is complex enough that I don't think you can learn it through a forum. So please allow me to direct you to some Internet resources that I used in order to learn RMI, and I hope will help you to as well.
    [Note: Not in any particular order.]
    http://java.sun.com/docs/books/tutorial/rmi/index.html
    http://developer.java.sun.com/developer/onlineTraining/rmi/
    http://java.sun.com/products/jdk/rmi/
    http://www.dickbaldwin.com/tocadv.htm
    http://mindprod.com/jglossrmi.html#RMI
    http://jinx.swiki.net/263
    Hope this helps.
    Good Luck,
    Avi.

  • Import data backup into another DB instance

    Hello all.
    I need to import a Data Backup into Another Database instance. MaxDb version 7.3.
    On higher versions of MaxDb I performed this operation without any problems (http://help.sap.com/erp2005_ehp_04/helpdata/EN/43/d5ebc2c9ed3ab3e10000000a422035/frameset.htm).
    For this version of MaxDB I have such problem:
    the commands don't coincide with help description, I define backup template, transfer DB instance to admin state, open utility session and try to srart recovery (there is no command db_activate RECOVER <template>)
    dbmcli on Q46>util_connect
    OK
    dbmcli on Q46>recover_start DEMO
    ERR
    -24988,ERR_SQL: sql error
    -903,Message not available,blockcount mismatch
    What I can do? How can I start recover from data backup from another DB on this version of MaxDB?

    I have tried to perform backup of original system and recovery to another database one more time.
    There is the another error:
    dbmcli on Q46>recover_start DemoD46_recover
    ERR
    -24988,ERR_SQL: sql error
    -3014,Invalid end of SQL statement

  • Multiple JVm instances error in iplanet 4.1

    the error message is :
    info ( 1184): JVM instance has already been created within the process, numVMs=1
    I have an NSAPI filter which uses JNI and will create an individual JavaVM.
    I understand in the process no more than 1 JavaVM shall be initialized yet I can't find a way to attach my NSAPI filter to the JavaVM created by the iplanet server.
    Does anybody has any idea how to solve this?

    Thanks for your reply. It seems odd though that IWS 4.1 seems to work fine w/sdk1.4.1 on my WinNT machine???

  • Chang system userid/password for another server instance

    It it possible to change the system userid/password for another server
    instance. If so , how ?
    I would like to allow certain groups to be able to start and stop ONLY their
    server without giving out the system account.
    Thanks in advance!

    the relationship between the infrastructure nodes and the application server nodes is a one to many relationship. The infrastructure home should be the only home that the EMWebsite service has been started for.
    the user to log in to em console is ias_admin/<password> if it does not accept the password that you set for this user then try it with caps lock on as you may have had it one when setting the password.
    As 9ias release 2 has been designed with a multiple machine install in mind, if you install more than one instance (multiple oracle homes) on the server then you will end up with multiple apache processes and oc4j processes. This means you will be able to connect to 2 apache server homepages under different ports. That is why you get the same page.

  • Trying to reinstall Acrobat Pro X from disc onto win 8.1 system. (Previous installation got corrupted) Continually getting message 'Acrobat has detected another process which has not yet completed-'. Have now closed system both cold (full shutdown) and wa

    Trying to reinstall Acrobat Pro X from disc onto win 8.1 system. (Previous installation got corrupted) Continually getting message ‘Acrobat has detected another process which has not yet completed…’. Have now closed system both cold (full shutdown) and warm (restart) over 10 times. Every time I go to reinstall I get message.

    I would run http://labs.adobe.com/downloads/acrobatcleaner.html and delete any Acrobat folders that have been created, then try again. Be sure to log in as the administrator and disable anti-virus when you have problems like this.

  • Launching another VM instance using Runtime.exec()

    Hi,
    I have two separate Swing applications, say A and B. I need to launch B from A using Runtime.exec() - essentially I am launching another VM instance from one VM. I am encountering strange problems - B's main window comes up, but GUI doesn't update; sometimes B comes up and GUI updates, but huge memory leaks happen. All the problems with B go away once A is shut down. It almost looks like both the instances of VM are sharing (or competing for) the event thread. Any comments will be of great help. Thanks.
    note: There is no problem launching B if A is a console java application (i.e. no Swing GUI).

    I have recently had the same problem, especially with the part where it seems like the two applications are sharing or competing for the same event thread. Sometimes my application B hangs like it is stuck waiting for an event. Sometimes I can get it to unhang by moving the app window around or minimizing it. If it does break free, all the queued events occur in rapid succession. Anybody have any clue what's going on here? It's pretty annoying.

  • DBMS_DATAPUMP import into another database instance

    Hi there,
    i have a quick question as i didn't find an answer in my oracle documentations...
    I use a PL/SQL program in a Oracle Application Express (APEX) application to import a dumpfile via the dbms_datapump API. It`s no problem to import it into the database on which APEX runs and i'm connected to in my application, but now i want to start an import of the dumpfile into another database. I know that it is possible in the commandline interface of the data pump tool to import a dumpfile from one database instance to another with a connect identifier in the connect string.
    Could someone tell me where i have to put these information in the datapump API?
    Fennek

    Hi,
    thx for the replies...
    I think damorgan is right, in the meantime i read somewhere else that you appearantly cant start an import into another databse instance out of PL/SQL...
    Well, maybe i will try to use dbms_scheduler to start an external script which starts the import tool like apex_disco wrote...
    Fennek

Maybe you are looking for

  • APEX_ITEM report - SORT doesn't work

    Hi, For the following report, the SORT doesn't work. I've also tried with the "Report Attributes", but same result. Does someone know is there a way to make it sorted or can confirm it's not possible. Thanks. SELECT APEX_ITEM.CHECKBOX(11,id_cc_delai_

  • How do display multiple accounts under one CalDav account?

    Hello - I have a google mail account, for which I use google calendar to organize both my and my wifes calendars. We share calendars, but she has a separate google account and calendar. Using iCal, both these calendars are subscribed using separate C

  • Split - error when mapping generated

    I have a mapping that uses a splitter to create 3 groups using the following conditions based on the value in the TYPE column: Group A: TYPE >= 4 Group B: TYPE in (2, 3) Group C: TYPE = 1 When I generate the mapping from the mapping designer, or depl

  • Custom Sync Problem (Unable to customize SYNC)

    I am trying to transfer ONLY few iPhoto events from my computer to Apple TV. iTunes, though, ignores any changes in SYNC settings and no matter what I check or uncheck to synchronize; the results is the same. It starts syncing everything, TV shows, m

  • Management and Shared Code

    I�m Microsoft .NET Developer and I use the Microsoft Visual Source Safe to share and to manager code in team projects. I would like of know if exist a similar Software to Java Environment?