0

So I have a java program of a game. I want to have a different program and when you click on a button there that java program closes and starts the program with the game. But I have no idea how I can do that, so can anyone help me?

user2971821
  • 33
  • 2
  • 6

2 Answers2

1

Using ProcessBuilder.The following is a reference,maybe not work.

ProcessBuilder pb=new ProcessBuilder("java","-jar","Test3.jar");
pb.directory(new File("F:\\dist"));
Map<String,String> map=pb.environment();
Process p=pb.start();
Su Xiang
  • 11
  • 2
0
  1. Create a runnable jar.
  2. call the runnable jar on button click.
  3. Exit from the current program.
Nishant Lakhara
  • 2,295
  • 4
  • 23
  • 46