Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有两个项目,一个生成消息并通过套接字连接将它们发送到服务器,另一个项目位于服务器端,使用消息并将它们发送到队列。无论如何,而不是先启动发件人项目然后启动我的服务器端项目,将第一个项目导出到 jar 文件,然后以某种方式调用 jar 文件并让它开始发送?
谢谢
如果你想通过代码调用你的 jar 文件,就是这样 -
Process p = Runtime.getRuntime().exec("cmd /c java -jar another.jar");