Running a Jar twice [closed]

早过忘川 提交于 2019-12-08 04:50:21

问题


is it possible to run a Jar twice?

e.g. consider a Jar which has 2 entry points. can I run them twice simultaneously, each time with an entry, without any kind of weird (like memory) problem?


回答1:


If your jar/application does not prevent a second start - yes If you start your application within different jvm's they are different processes which (usually) have no shared memory.




回答2:


Yeah, it's fine. You can run one jar files multiple times, like starting tomcat server twice, which is a pretty common setup. In my understanding, there is no memory leaking problem at all. On the contrary, modern JRE can enable class-sharing among multiple process, which can save considerable memory.




回答3:


Firstly, i dont think java interpreter alone understands multiple entry points. But you can write an application which understands this and launch the correct Main-class.

Secondly, even if java inrterpreter knew to launch multiple entry points it should be launching each in a separate JVM making it safe.



来源:https://stackoverflow.com/questions/10256395/running-a-jar-twice

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!