简体   繁体   中英

Creating standalone Mac App from JAR file

I'm new to java but have built an application in eclipse which functions as intended. The end goal is to create a standalone.app with an icon for a user to click to run the application.

I've exported the project and created a standalone.jar file which when I double click, does not open. I get the error "The Java JAR file "File Name.jar" could not be launched. Check the Console for possible error messages." And when I look in the console, I don't see any error messages.

When I try to open my jar file in terminal with "java filename.jar", I get the error: "Error: could not find or load main class". However, when I launch the jar file in terminal, with "java -jar filename.jar" it opens fine.

I've packaged up the app using JarBundler, however the final.app file does not work either.

I don't know what to troubleshoot in order to get the.app file to open. Do I need my standalone executable jar to be able open without calling "java -jar", or is that unrelated? Why would my java file open with that but not without? Any guidance would be greatly appreciated.

You can use jpackage to create installable packages for Linux, Windows, and macOS. It's part of the JDK, so no need for extra tools.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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