Open jar file using JRE on Mac

半腔热情 提交于 2019-12-10 15:14:48

问题


I have a jar file that is meant to be ran through the command line.

I am not planning to do any java development on the machines where the application will run and my thought process is that therefore I should only need the JRE and not the JDK. In addition, the JDK is like 4x as big as the JRE and I would like to not have to download it.

When installing the JRE on a Mac, it does not set the path for the java command and if I try to run it, osx prompts me to install the JDK.

I wonder if anyone could provide some insight as to how to use the java command in a mac without having the download the bigger sized JDK?

Thanks a lot.


回答1:


Have you tried running this in terminal?

java -jar MyJarName.jar

However, you can also try and make a runnable application of the jar file. Take a look at Packaging a Java App for Distribution on a Mac

EDIT: You can also try running your starter class from the terminal. cd to the bin folder of your project, then java packageName.className. For example, java my.package.Starter.



来源:https://stackoverflow.com/questions/30784846/open-jar-file-using-jre-on-mac

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