简体   繁体   English

批处理文件以运行Java应用。 如何在Mac中移植?

[英]Batch file to run a java app. How to port it in Mac?

I have a tiny batch file to kick off my java app: 我有一个小的批处理文件可以启动我的Java应用程序:

its code is something as simple as 它的代码很简单

java -jar myapp.jar 

(in reality it's slightly more complicated as we set a few properties) (实际上,设置一些属性会稍微复杂一些)

A friend of mine has a mac. 我的一个朋友有一台Mac。 He has java installed on his mac. 他在Mac上安装了Java。 But how do we run this batch from mac ? 但是我们如何从Mac运行此批处理?

Put the following code into a file and run chmod +x <filename> to make it executable. 将以下代码放入文件中,然后运行chmod +x <filename>使其可执行。

#!/bin/sh
java -jar myapp.jar 

If the Java app. 如果是Java应用程序。 is a desktop app. 是一个桌面应用程序。 with a GUI, a good way to launch it is using Java Web Start . 使用GUI,启动它的一个好方法是使用Java Web Start JWS provides the ability to set properties in the JNLP launch file. JWS提供了在JNLP启动文件中设置属性的功能。

JWS works on all desktop JREs. JWS可在所有桌面JRE上使用。 EG it will work on Windows, Mac. 例如,它将在Windows,Mac上运行。 and *nix. 和* nix。

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

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