简体   繁体   English

如何绑定2个Java文件,以便在运行jar文件时它们都可以打开

[英]How do I bind 2 java files so they both open when I run the jar file

I think this can be done in eclipse? 我认为这可以在日食中完成吗? But how. 但是如何。

Basically what I want is to turn 2 java jars into 1 jar file and when I run it they both run. 基本上,我想要将2个Java jar转换为1个jar文件,当我运行它时,它们都会运行。

There may be other ways, but one way to do this is by running the second jar file through the first file. 可能还有其他方法,但是一种方法是通过第一个文件运行第二个jar文件。 You can run the second file as: 您可以将第二个文件运行为:

String cmd = "java -jar "+getClass().getResource("secondFile.jar").getPath().substring(1);
Runtime.getRuntime().exec(cmd);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM