0

I am not sure if its possible to create a duplicate session on Application.

I have an application developed using Java Swing, which will help to copy contents to the clipboard. I am currently using it as Exe file (converted Jar using Launch4j).

My Concern, I have to add a button or an option that will help me to open a duplicate session of the application on the same machine, like having two applications open at the same time. Is that possible?

Please suggest.

private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {                                           
        String params = null;
        try {
            Runtime.getRuntime().exec(params);
        } catch (IOException ex) {
            Logger.getLogger(Handoff.class.getName()).log(Level.SEVERE, null, ex);
        }
    } 

1 Answer 1

3

you can always launch another executable from a java program using Runtime.getRuntime().exec(params) or other APIs, which you can use to run your binary again.

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you for your reply. I am having difficulty in initializing params. If I initialize as "Null", I am getting null pointer exception when the run the program. I added an option duplicate session as the menu option on the App. So when I click on duplicate session is when I get the run time exception. I have added code above, please suggest
@sady Why would you try to execute an empty string? How do you expect the Runtime class to know what you want to do? Also, do not edit your Question to create a new issue; first search Stack Overflow and if not found then post a new Question. This Answer by Attias addresses your original Question and should be accepted.
@BasilBourque Apologize, I made a fool out of myself. I got your point.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.