0

With the help of Netbeans, I made a Java desktop application. I just made another class in that package where I just added a button. I meant it for the purpose of running Java desktop application which I made earlier. When searched for the main method of appview.java (only this contains a main) there was code like this:

public static void main(String[] args) {
    launch(SRECOApp.class, args);
}

I tried to put launch(SRECOApp.class, args); in the action listener of the button, but it didn't work. Please, what should I do now?

lmazgon
  • 1,215
  • 1
  • 21
  • 40
  • So if I understand correctly you want to achieve this behaviour: 1. Application launches and a window with a button appears 2. The click on the button launches the main app - maybe this answer can help http://stackoverflow.com/a/15681589/1212463 – lmazgon Dec 02 '14 at 18:09
  • exactly but the link you posted have nothing like that.please see the code I written over there –  Dec 02 '14 at 18:18
  • What I meant with that answer is, that you should create a new Stage object and open the second application. I assume you have two Application objects in your code - if you have only one, then this is the answer you are looking for http://stackoverflow.com/a/20967174/1212463 – lmazgon Dec 02 '14 at 18:26

1 Answers1

0

This is what the Desktop class and the Runtime class are meant for.

Desktop class is more to open an application associated to a file (via its file extension).

Runtime class is more to open an application and passing parameters to this application.

Eg:

Runtime.getRuntime().exec("notepad.exe")
lvr123
  • 524
  • 6
  • 24