Getting the instance of a program

I'm trying to build an app that when starting checks if there's another instance of the same program running, and get an instance to the other program. Basically i'm trying to avoid having 2 application windows, and reuse the existing window when the program is called again.
Is there a standardized method for doing so? if not, does anyone have some sample code ?
Regards,
too-much-coffee-today

http://www-128.ibm.com/developerworks/java/library/j-shared/?ca=dgr-jw01j-shared

Similar Messages

  • Getting the Instance of a Class

    I have this program where each user had there own prefences stored in there directory. A class called UserPrefences load the prefences into the data members of that class.
    The problem is I want to get the instance of that prefences which was loaded to be accessed by other classes. I don't want to have to reload all the prefences again from a text file but rather get the instance of UserPrefences from different class. So how do I get the instance of that one class without creating a new object each time I access prefences from a different class?

    Singleton????It's a design pattern you use when you want exactly one instance of something to exist.
    Can there be a static class? Top level classes cannot be static, but you can have a class full of static member variables.
    Because there are many
    fields in these prefences.Not sure how that's relevant.
    You've given almost no information about your requirements, so I can't really give you any more specific help.

  • Get the instance names of clips attached to a movieclip

    I want to get the instance names of all the cmovieclips that
    are attached to a movieclip.
    Is there a simple way to do this.
    I imagine this is something that can be done with AS3 but can
    it be done with AS2?
    regards J

    you're welcome.
    FYI: a for...in loop loops through all the accesible
    properties (in the broadest sense of the meaning, includes
    methods/functions and variables etc). Each time it finds one it (in
    this case) assigns the property name to the variable 'unknown'
    the code inside the loop just checks
    a) is it a property that references a movieclip instance and
    b) is it the same property name as the movieclip instance's
    _name property (this is to avoid listing additional references to
    the same movieclip instance that may be set up as variables in your
    McA's scope).
    I just read that and I'm wondering if it actually will help
    you understand... its quite complicated to describe,sorry...
    although its simple to understand once you get used to it. To learn
    you should experiment with a few for.. in loops on different
    objects and see what trace outputs you get.

  • How do I get the instance of a serviceticket in ICCMP_BTPARTNER?!

    Hi all,
    I want to find out which instance/ibase is currently set in a serviceticket. I am in the component "ICCMP_BTPARTNER" in the view "PARTNERTABLE".
    I thought I might get the instance of the serviceticket in the global data context in GDC_CURRENTIBASE or GDC_CURRENTSERVICETICKET. But the CURRENTIBASE is initial and in SERVICETICKET the only information I get is the CRM_GUID. 
    I tried something like this...
      CLEAR: lr_gdc.
      TRY.
          lr_gdc ?= cl_crm_ui_data_context_srv=>get_instance( iv_controller = me ).
        CATCH cx_root.
      ENDTRY.
      CHECK lr_gdc IS BOUND.
      CALL METHOD lr_gdc->get_entity
        EXPORTING
          name  = if_iccmp_global_data_cont_con=>gdc_currentibase
        RECEIVING
          value = lr_serviceticket.
      CHECK lr_ibase IS BOUND.
    So, does anyone know how to get the current instance of a serviceticket in any other components view (here ICCMP_BTPARTNER/PartnerTable)?
    Thanks for your help.
    Best regards.
    Ben

    Done.
      DATA: lr_gdc             TYPE REF TO if_crm_ui_data_context.
      DATA: lr_serviceticket   TYPE REF TO if_bol_bo_property_access.
      DATA: lr_entity          TYPE REF TO cl_crm_bol_entity.
      DATA: lv_instance        TYPE ib_instance.
      CLEAR: lr_gdc.
      TRY.
          lr_gdc ?= cl_crm_ui_data_context_srv=>get_instance( iv_controller = me ).
        CATCH cx_root.
      ENDTRY.
      CHECK lr_gdc IS BOUND.
      CALL METHOD lr_gdc->get_entity
        EXPORTING
          name  = if_iccmp_global_data_cont_con=>gdc_currentserviceticket
        RECEIVING
          value = lr_serviceticket.
      CHECK lr_serviceticket IS BOUND.
      CLEAR: lr_entity.
      lr_entity ?= lr_serviceticket.
      CHECK lr_entity IS BOUND.
      CLEAR: lv_instance.
      TRY.
          lr_entity = lr_entity->get_related_entity( 'BTOrderHeader' ).
          CHECK lr_entity IS BOUND.
          lr_entity = lr_entity->get_related_entity( iv_relation_name = 'BTHeaderBOSSet' ).
          CHECK lr_entity IS BOUND.
          lr_entity = lr_entity->get_related_entity( iv_relation_name = 'BTRefObjSet_A' ).
          CHECK lr_entity IS BOUND.
          lr_entity = lr_entity->get_related_entity( iv_relation_name = 'BTRefObjectComponentsAll' ).
          CHECK lr_entity IS BOUND.
          lv_instance = lr_entity->if_bol_bo_property_access~get_property_as_string( 'IB_INSTANCE' ).
        CATCH cx_crm_genil_model_error cx_root.
      ENDTRY.

  • TS3212 When I upgraded to the latest iTunes, it did not install properly on my PC. I get the message: Runtime Error, Program C:\Program Files (x86), R6034, An application made an attempt to laod C runtime library incorrelcty. I have empted temp folder & r

    When I upgraded iTunes to the latest version, it did not install proberly. I get the message: Runtime error, Program C\Program Files (x86), R6034, An application has made an attempt to load C runtime library incorreltyl. I have empted all of the temp folder I can find, uninstalled iTunes, and restarted my PC. How can I get iTunes to load properly?

    Click here and follow the instructions.
    (99035)

  • How to get the output of a program into the email program.

    hi
    i had created a java mail program and the keygeneration program.seperately.
    i want to get the keygeneration into my email program.that should be sent along with the text message.so pls help me in this regared.
    i had pasted my coding her
    email pgm.
    import javax.mail.*;
    import javax.mail.internet.*;
    import java.util.*;
    import java.io.*;
    To use this program, change values for the following three constants,
    SMTP_HOST_NAME -- Has your SMTP Host Name
    SMTP_AUTH_USER -- Has your SMTP Authentication UserName
    SMTP_AUTH_PWD -- Has your SMTP Authentication Password
    Next change values for fields
    emailMsgTxt -- Message Text for the Email
    emailSubjectTxt -- Subject for email
    emailFromAddress -- Email Address whose name will appears as "from" address
    Next change value for "emailList".
    This String array has List of all Email Addresses to Email Email needs to be sent to.
    Next to run the program, execute it as follows,
    SendMailUsingAuthentication authProg = new SendMailUsingAuthentication();
    public class SendMailUsingAuthentication
    private static final String SMTP_HOST_NAME = "smtp.mail.yahoo.com";
    private static final String SMTP_AUTH_USER = "xxxx";
    private static final String SMTP_AUTH_PWD = "xxxx";
    //private static final String emailMsgTxt = "Online Order Confirmation Message. Also include the Tracking Number.";
    private static final String emailSubjectTxt = "Order Confirmation Subject";
    private static final String emailFromAddress = "[email protected]";
    private static String emailMsgTxt = "I am unable to attend to your message, as I am busy sunning"
    + "myself on the beach in Maui, where it is warm and peaceful."
    + "Perhaps when I return I'll get around to reading your mail."
    + "Or perhaps not.";
    private static final String[] emailList = { "[email protected]","[email protected]"};
    public static void main(String args[]) throws Exception
    SendMailUsingAuthentication smtpMailSender = new SendMailUsingAuthentication();
    smtpMailSender.postMail( emailList, emailSubjectTxt, emailMsgTxt, emailFromAddress);
    System.out.println("Sucessfully Sent mail to All Users");
    public void postMail( String recipients[ ], String subject,
    String message , String from) throws MessagingException
    boolean debug = true;
    Properties props = new Properties();
    props.put("mail.smtp.host", SMTP_HOST_NAME);
    props.put("mail.smtp.auth", "true");
    props.put("mail.smtp.port", "25");
    props.put("mail.smtp.protocol","smtp");
    props.put("mail.debug", "true");
    Authenticator auth = new SMTPAuthenticator();
    Session session = Session.getDefaultInstance(props, auth);
    session.setDebug(debug);
    // create a message
    Message msg = new MimeMessage(session);
    // set the from and to address
    InternetAddress addressFrom = new InternetAddress(from);
    msg.setFrom(addressFrom);
    InternetAddress[] addressTo = new InternetAddress[recipients.length];
    for (int i = 0; i < recipients.length; i++)
    addressTo[i] = new InternetAddress(recipients);
    msg.setRecipients(Message.RecipientType.TO, addressTo);
    // Setting the Subject and Content Type
    msg.setSubject(subject);
    msg.setContent(message, "text/plain");
    Transport.send(msg);
    private class SMTPAuthenticator extends javax.mail.Authenticator
    public PasswordAuthentication getPasswordAuthentication()
    String username = SMTP_AUTH_USER;
    String password = SMTP_AUTH_PWD;
    return new PasswordAuthentication(username, password);
    keygeneration program:
    import java.io.Serializable;
         import java.security.Security;
    import com.sun.net.ssl.*;
         import javax.crypto.KeyGenerator;
         import javax.crypto.Mac;
         import javax.crypto.SecretKey;
         public class Eval {
         public static void main(String args[]) throws Exception {
         String inputString ="0x0b0b0b0b";
         KeyGenerator keyGen = KeyGenerator.getInstance("HMACMD5");
         SecretKey secretKey = keyGen.generateKey();
         Mac mac = Mac.getInstance(secretKey.getAlgorithm());
         mac.init(secretKey);
         byte[] byteData = inputString.getBytes("UTF8");
         byte[] macBytes = mac.doFinal(byteData);
         String macAsString = new sun.misc.BASE64Encoder().encode(macBytes);
         System.out.println("Authentication code is: " + macAsString);

    I'm not sure what's confusing you. Just generate a String (using a StringBuffer)
    with the data you need and use it as the content of the mail message. If each
    recipient needs different content, they'll each need a different MimeMessage
    object.

  • I'm trying to update iTunes to 10.5.2 and I get the message that "a program required for this install to complete could not be run".  I've tried all of the steps to try to resolve this (I have a PC) but nothing works.  Help please!

    I'm trying to update iTunes to 10.5.2.  I have a Windows 7 64-bit Dell laptop, and when I try to update it, I get the message "There is a problem with this Windows Installer package.  A program required for this install to complete could not be run.  Contact your support personnel or package vendor." 
    I went to the troubleshooting page and did all of the steps they listed:  uninstalled iTunes, deleted by Temp files, even disabled AVG while I downloaded again and tried to install.  I still get the same message.  If anyone can help me, I would really appreciate it!

    You must have gone to the old microsoft post.
    Here is the link:
    http://support.microsoft.com/kb/2438651

  • How can I use evaluate to get the instance variable in customized tag

    1.
    At first , I create a class called bean,and declared several params in it and do not define any getter function for the param.
    class bean{
    String param = "test";
    SomeClass scObj = new SomeClass();
    2.
    The second ,I use
    request.setAttribute("beanObj",new bean());
    3.
    And then I wanna use the customized tag to show a text box , then initialize it's value.
    <salt:text name="param" value="beanObj.param">
    <salt:text name="obj" value="beanObj.scObj.func()">
    4.
    I tried the evaluator provided by JexlContext ,Struts, JSTL and it seems that if I do not define the getter for the variable ,I can not get the bean's instance variable's value.
    Expression e = ExpressionFactory.createExpression( value );
    JexlContext jc = JexlHelper.createContext();
    jc.getVars().put(strInitBeanName, request.getAttribute("beanObj"));
    Object obj = e.evaluate(jc);
    the result of the obj is null....
    Can anybody recommand some other evaluator can get the value of a instance variable from an object?

    do you have any other suggestion ? Nops, somebody else may have though. AFAIK, all lookups of the type
    beanName.propertyNameuse reflection on the getXXX() methods to access the property.
    Having said that, I guess you could write one though in a custom tag, using the same - reflection (you will ahve to rely on the java.lang.reflect.Field class quite heavily) - but that would be reinventing the wheel for most other functionality that you would have to include (like looking up the bean in scope etc)
    cheers,
    ram.

  • How to get the instance id of BPEL in OSB

    We have the process in OSB which will invoke the BPEL ansync process and returns success once the BPEL is invoked.
    Can we refer/get the BPEL instance id in OSB by anymeans?

    There is another option. You may set the unique instance name in BPEL process based on some value in the payload. From OSB you may query composite_instance table of SOAINFRA schema on the basis of instance name (title column) and/or composite name (composite_dn column) to get the value of instance id (ID column) and return it in response from OSB.
    Regards,
    Anuj

  • STAD - get the 'transaction code' and 'program name'

    Hi, I was wondering if someone knows about a bapi with which I can get only the "transaction code" and "program name".
    I need to get those for a specified user, but I don't want to set on a trace, that's why I'd like to use the transaction STAD.
    If anyone can help, thanks in advance
    Grtz,
    Dragovian

    ok, so I go like this
    TYPE-POOLS sapwl .
    DATA:  all_stats        TYPE sapwl_allstats.
      CALL FUNCTION 'SAPWL_READ_STATISTIC_FILES'
       EXPORTING
         read_client                 = '*'
         read_time                   = '200000'
         read_start_date             = sy-datum
         read_start_time             = '000000'
         read_username               = sy-uname
         read_workprocess            = 'FFFF'
         wait_factor                 = 150
        CHANGING
          all_stats                   = all_stats
    how'd I get "start-time" "report-name" "date" "username"?

  • How can I get the responsibility for concurrent programs

    Guys,
    How can I get the responsibility for a list of concurrent programs. Is there a query that I can run to get the results?
    Thanks in advance,

    Refer to Note: 134036.1 - WHOCANRUN.SQL - List Responsibilities That Can Run a Given Concurrent Program
    https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=134036.1
    From the output of the query in the note referenced above, you can run "Users of a Responsibility" concurrent program then to find out the list of users who have access to a certain responsibility.

  • HT1923 HI...trying to uninstall iTunes components, but get the error that another program is trying to install..wait until it's finished then try to install. Install? I clicked UNinstall! Nothing is installing!?!?!?! HELP!

    Hi,
    Getting Runtime Error 6034. When I attepmt ot follow the suggetions to rectify this issue, I get the erroe message that anothe program is tryin to install. Wait until it's finish and try install again. 'Install'????? I clicked UNinstall!!! How can I find if something is trying to install? I am not installing anything. HELP!!!! PLEASE!!!!

    I get the erroe message that anothe program is tryin to install. Wait until it's finish and try install again.
    Restart the PC. Can you complete the uninstalls now, or do you still get the message?

  • How to get the instance name from the SWFLoader?

    Hi Guys,
    I am new to Flex. i need help from u.
    i load the swf file through the SWFLoader in Flex 3.
    Than how to get the instace(button,text,etc.,) of the loaded
    swf.
    Please help me.

    Yes. hashcode is not absolutely unique. I know this.
    I had took this idea into my consideration. But it failed finally.
    Thanks
    To JN_.
    Maybe I still have some misunderstood descripte my question.
    neither the name not an "instance name" nor an "object name".
    So now, I really do not know how to call this.
    Can you tell me? Then I will not make the same fault next time.
    thanks.

  • How to get the Instance Name of Creator

    Hi all.
    I have an idea but I don't how to implement it. I have tried about two days.
    the simplified concept that what I wnat is as follows
    class classA {
    classB objB = new classB();
    class classB {
    puclic void showObjName(){
    //How can I the Instance Name of Creator here?
    //In this Example. The name is objA.
    public class showCreator {
    public static void main(String[] args) {
    classA objA = new classA();
    I try to instanciate an Throwable Object and use the getStackTrace method.
    but all information in the stack I got Do Not contain the Instances Name.
    Does any one have idea to implements this...
    Thanks.

    Yes. hashcode is not absolutely unique. I know this.
    I had took this idea into my consideration. But it failed finally.
    Thanks
    To JN_.
    Maybe I still have some misunderstood descripte my question.
    neither the name not an "instance name" nor an "object name".
    So now, I really do not know how to call this.
    Can you tell me? Then I will not make the same fault next time.
    thanks.

  • Ever Since I upgraded to Mountian lion 10.8.2 I have been getting the spininng wheel on programs more than ever ..Anyone know of a fix ?

    I use firefox and since i HAVE UPGRADED to 10.8.2 I have been getting the spinning wheel more than ever. I have to force quit browser to have it stop . It's very annoying and I have talked to a few other's that are having this same problem. It's getting very annoying and need to do something about it. I have used OnyX to clean up my Mac, but that doesn't seem to help at all.  Has anyone else here been experiencing these issues .. Firefox. Skype etc ....

    I use firefox and since i HAVE UPGRADED to 10.8.2 I have been getting the spinning wheel more than ever. I have to force quit browser to have it stop . It's very annoying and I have talked to a few other's that are having this same problem. It's getting very annoying and need to do something about it. I have used OnyX to clean up my Mac, but that doesn't seem to help at all.  Has anyone else here been experiencing these issues .. Firefox. Skype etc ....

Maybe you are looking for

  • Adf bc project little bug

    When creating a new adf bc project the name for the project is wrong displayed, a "0" is added to the name. Model0 is displayed instead of Model or model depending on the location

  • Number Precision in Materialized View

    Hey, I have created several materialized views with multiple fields of data type number. I would like to have those number fields created with max length 5 and precision 0 (no decimal places). I am thinking that each of those database fields will the

  • Resizing Image objects to keep inline with JFrame width?

    Hi, just wondering if you had a GUI with an image in it, how you would code an image object to resize itself to keep its scale relative to the JFrame its in, if that frame was being resized by the GUI user? Thanks!

  • Camera Connection Kit ROCKS

    After a several weeks wait, I finally received my camera connection kit today. It's small, simple, and easy to use - just plug it in, and it works - at least that was my experience. I bought it primarily to download photos from my camera, and be able

  • Reason for change name

    hi, what is the reason behind HTMLDB had change it name to Applicaiton Express? thanks.