Run a jar File from java program

后端 未结 3 2082
臣服心动
臣服心动 2020-12-01 17:50

I am trying to execute jar files from another Java program. I am using the following code :

      try {
          Runtime runtime = Runtime.getRuntime();
           


        
3条回答
  •  余生分开走
    2020-12-01 18:09

    You can run a jar file from where ever you want by using only this one line code.

        Desktop.getDesktop().open(new File("D:/FormsDesktop.jar"));
    

    where

    new File("your path to jar")
    

    Hope it helps.

    Thanks.

提交回复
热议问题