I want to bundle my .jar app to automatically run open on mac os. It has no GUI so it needs to be run from terminal to work but I need to give it to others who would rather not use terminal. How would I go about doing this? I tried the app builder that is seen here but it only shows up on activity monitor for a fraction of a second before going away. More info about my jar file: It was build in netbeans so it does have all the folders/xml needed to build a jar via ant. It needs a few additional libraries that are copied to the lib folder when netbeans builds the project. Thirdly it needs to store temp files in a folder called assets that is located in the same folder as the jar file is. I can change number 3 if need be.
问题:
回答1:
Your issue doesn't really have much to do with running on the mac - the problem is that you're trying to run a console app without a console.
Here is an example of one way to provide a console in a GUI window, rather than running the app in an shell (the terminal).
Once you have that working, you can consider wrapping it in the Mac - specific deployment that you pointed to.
For portability's sake, you may also want to consider:
Re-packaging your classes and all of the classes from your jar dependencies into one big "uber-jar" - there are several tools for doing this, including the Maven Assembly Plugin
Storing your temporary files in the system's default temp file location (using File.createTempFile) instead of specifying exactly where they should be written.