macos 将 .Jar 转换为 .Dmg
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4395948/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Convert .Jar to .Dmg
提问by Jinith
I have a java application with jar file and a lib folder to go with it,and i want to bundle my application along with the lib files and folders into a .DMG file to run on MAC OS x so if anybody has a similar experience please help me out.
我有一个带有 jar 文件和 lib 文件夹的 java 应用程序,我想将我的应用程序与 lib 文件和文件夹捆绑到一个 .DMG 文件中以在 MAC OS x 上运行,所以如果有人有类似的经验,请帮帮我。
Thanks in advance
提前致谢
采纳答案by Constantin
You put all your files in one folder together. Then you open the Disk Utility (Applications -> Utilities -> Disk Utility) and choose "New Image from folder..."
您将所有文件放在一个文件夹中。然后打开磁盘实用程序(应用程序 -> 实用程序 -> 磁盘实用程序)并选择“从文件夹中新建图像...”
That's all.
就这样。
回答by khachik
You might want to make a dmg disk image from the makefile/build file:
您可能想要从 makefile/build 文件制作 dmg 磁盘映像:
hdiutil create -srcfolder <directory> <dmg_file_name>.dmg
回答by HCarrasko
You can use the javapackager toolto build the you_app.app application and wrap it into an installer:
您可以使用javapackager 工具构建 you_app.app 应用程序并将其包装到安装程序中:
mkdir -p package/macosx
cp you_icon_app.icns package/macosx
jdk=$(/usr/libexec/java_home)
$jdk/bin/javapackager -version
$jdk/bin/javapackager -deploy -native dmg \
-srcfiles you_app.jar -appclass you_app_name -name you_app_name \
-outdir deploy -outfile you_app_name -v
cp deploy/bundles/you_app_name-1.0.dmg you_app_name-installer.dmg
And done.
并做了。
回答by Gene De Lisa
I use a maven plugin: osxappbundle-maven-plugin
我使用了一个 Maven 插件:osxappbundle-maven-plugin