在Mac上使用JRE打开jar文件 [英] Open jar file using JRE on Mac

查看:713
本文介绍了在Mac上使用JRE打开jar文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个jar文件,可以通过命令行运行。

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

我不打算在应用程序所在的机器上进行任何java开发运行和我的思维过程是因为我应该只需要JRE而不是JDK。另外,JDK就像JRE一样大4倍,我不想下载它。

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.

在Mac上安装JRE时,它没有设置java命令的路径,如果我尝试运行它,osx会提示我安装JDK。

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.

我想知道是否有人可以提供一些有关如何运行的见解在Mac中使用java命令而不下载更大的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?

非常感谢。

推荐答案

您是否尝试在终端中运行此功能?

Have you tried running this in terminal?

java -jar MyJarName.jar

但是,您也可以尝试制作jar文件的可运行应用程序。请查看在Mac上打包Java App以进行分发

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

编辑:
您也可以尝试从终端运行入门级。 cd 到项目的bin文件夹,然后 java packageName.className 。例如, java my.package.Starter

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.

这篇关于在Mac上使用JRE打开jar文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆