Reputation: 2012
I am building a small Java program for a Mac user who is an absolute novice when it comes to computing. Therefore, I would like to give him one file to execute, perhaps via a script. Before, I just gave the .jar file, which would run perfectly, but now I have to add VM arguments (max heap space). Unfortunately, I'm not well acquianted with OSX. So far, I was able to give the .jar and a .command file containing the text
#!/bin/bash
java -jar -ms128m -mx512m -jar file.jar
However, this gives the message 'The file could not be executed because you do not have appropriate access privileges'. One solution is to use sudo in the console, but I'm afraid this is too complex. Therefore my question:
edit: I do not have unlimited access to a Mac, so I would need a solution that does not require a Mac at each update of the .jar file.
Thanks a lot!
Upvotes: 2
Views: 2851
Reputation: 2006
If you have a Mac you can try out the Jar Bundler. It come with XCode or perhaps you can find it here https://developer.apple.com/downloads. With this app you can make a 1 Click Mac Executable.
I don't know if it's possible with a Windows Eclipse version. Go to the Main-Class open the context menu and start the Export dialog. Search for Mac OS X application bundle and follow the steps.
Create an extra Java "starter" class which starts itself again. You can call with ProcessBuilder
another jar like this java -Xms1024M -Xmx1024M -jar app.jar
.
Upvotes: 2
Reputation: 10352
You can create a Mac executable quite easily. You should create a directory with an extension .app and put your files there. It should contain a subdirectory called Contents where you should put a file named Info.plist where you can specify JVM parameter and a lot of other stuff. As an example, you can use the IntelliJ Community Edition package.
Upvotes: 1