jorl17 / jar2app Goto Github PK
View Code? Open in Web Editor NEWConvert any Java jar to a Mac OS X .App bundle. No external tools needed, no funky parameters, it just works.
License: GNU General Public License v2.0
Convert any Java jar to a Mac OS X .App bundle. No external tools needed, no funky parameters, it just works.
License: GNU General Public License v2.0
jar2app doesn't change the displayed icon shown in finder. The only way I've found that this can be done is to open the icon in preview copy and paste it into the Get Info top left icon area of the application. Can this be fixed so this step is not needed.
Example Usage:
$ jar2app myapp.jar -n "MyApp" -i "myappicon.icns"
MyApp.app shows a script icon and not the icon chosen in the command.
This was done with Mac OS Verison: macOS Mojave version 10.14.2
java -noverify -Xbootclasspath/p:load.jar -jar work.jar
is work
try to use jar2app work.jar -j "-noverify -Xbootclasspath/p:load.jar"
,move load.jar to work.app/Contents ,but it doesn't seem to work.
try to use -m "load.jar"
, move load.jar to work.app/Contents,get error:not found load.jar.
I would like to pack a java application with script
my script starts with java -jar myapp.jar file.txt
to convert it to macos
I converted my jar with your tools but the problem when I run
open -n myapp.app file.txt the program does not see the arguments?
Simply put, is there a way to not have the jdk added in the plugins folder? I do not need it, and I cannot disable it.
For our project we package a Slim jar and then included all our dependency's as jar's as well.
Is it possible to add an option to package multiple jars, so in the Java directory instead of just having our one excitable jar we also want to package multiple other jar's that we depend on?
Env:
Run jar2app xxx.jar
maybe get a python env
error, you can exec terminal command ln -s -f /usr/local/bin/python3 /usr/local/bin/python
to fix it.
Mac Mini M1
macOS 13.3.1 Ventura
python 3.9.6
I've installed jar2app
in /usr/local/bin
When I issue the command jar2app convertwithmoss-6.2.0.jar
, i get the error message env: python: Not a directory
I looked at #56, and issued the command ln -s -f /usr/local/bin/python3 /usr/local/bin/python
and then tried the jar2app
comand again with the same result.
https://sourceforge.net/projects/msgviewer/ creates an additional subdirectory, lib/
at the same level as the application jar with additional jar library files and I do not see a way to make a reference or include this structure when rolling up the wrapper .app structure.
[ <user@machine>:~/Desktop/MSGViewer-1.9 08:34 ]$ jar2app MSGViewer.jar
jar2app 1.0.1, João Ricardo Lourenço, 2015-2017 <[email protected]>.
Github page: https://github.com/Jorl17/jar2app/
Packing MSGViewer.jar into ~/Desktop/MSGViewer-1.9/MSGViewer.app
CFBundleIdentifier: com.jar2app.example.MSGViewer
CFBundleDisplayName: MSGViewer
CFBundleName: MSGViewer
CFBundleShortVersionString: 1.0.1
CFBundleSignature: ????
CFBundleVersion: 1.0.1
Retina support enabled.
---
JVMMainClassName: net.sourceforge.MSGViewer.ModuleLauncher
Executable Name (CFBundleExecutable): JavaAppLauncher
JAR Working directory: $APP_ROOT/Contents
MSGViewer.jar packaged to ~/Desktop/MSGViewer-1.9/MSGViewer.app
Fails to run. Rightly so, missing additional libraries. Moving the lib/*
files into a MSGViewer.app/Contents/Java/lib
subdirectory fixed the issue, but you don't have an include option additional dir's or files in the build process nor documentation to move things around.
This program is great by the way. Simple and to the point. Hope this improvement or documentation can be worked in.
# craete app
jar2app my.jar -r jdk/ -b me.wener.tools -d my -i ./my.icns -j '-Xmx64M'
# codesign
codesign -s "iPhone Developer: xxx" --force --deep --verbose my.app
my.app: bundle format unrecognized, invalid, or unsuitable
In subcomponent: /Users/wener/my.app/Contents/PlugIns/jdk/Contents/Home/jre/legal/java.xml
Hello,
I like to have the macOS menu bar to be used instead of the Java menu bars.
For example, the menu bar of Umlet shown as a native macOS menu bar.
I used to do this with XCode's Jar Bundler, using the option "Use Macintosh menu Bar". This worked fine, but Jar Bundler is now discontinued.
There seems also a command line flag for achieving it.
Regards,
Max
I created my own calculator using javaFX and of course java, and I wanted to create an application that I can run instead of the given apple one because I thought it would be funny and (somewhat) cool. I have gotten to the point where I have a jar file; however, I am not able to simply run "java -jar filename.jar". To get it to run on the command line I need to run a much longer command "java --module-path /Users/zbmach/Java/Extensions/javafx-sdk-11.0.2/lib --add-modules javafx.controls,javafx.fxml -jar Calculator-1.0-SNAPSHOT.jar". I assumed that the part starting at --module-path and ending right before the -jar are the jvm options. Because of this I input "jar2app Calculator-1.0-SNAPSHOT.jar -n "Calculator 2" -i Calculator.icns -j "--module-path /Users/zbmach/Java/Extensions/javafx-sdk-11.0.2/lib --add-modules javafx.controls,javafx.fxml" -r "/Library/Java/JavaVirtualMachines/jdk-15.0.1.jdk/Contents/Home"". I would love if someone could help me figure out what I need to change when creating the app to eliminate the error I am getting!
It does not natively work on ARM based systems.
The app file created from the base command: jar2app <NAME>.jar
Hey, any reason for not distributing on Homebrew?
If you like I can create the formula for it quite easily and submit it to be included, just need a release (part of their policy is not to accept anything HEAD-only, so need a github release) it would be awesome to add it to homebrew as thats where I and I am sure many other look for things on macos first, and it makes for simple, unified package management.
This is not really an issue.
You know that Gentoo is considered by many to be the most powerful distribution of GNU/Linux. In Gentoo, you compile every program from source, rather than using the distribution maintainers' precompiled binaries. This means that every program is specially tailored to your system and needs and is better optimized.
Why did you switch from Gentoo GNU/Linux to Mac OS ? What made you change your mind?
Okay, here is what I did to successfully sign a bundled .jar. You need to
First we need to change the provided binary of JavaAppLauncher:
xcrun vtool -set-version-min macos 10.9 10.9 -replace -output JavaAppLauncher.new path/to/original/JavaAppLauncher
This vtool command is provided with Xcode and sets the linked SDK version to 10.9, which is needed for code signing.
Don't forget to exchange the JavaAppLauncher binaries, so that the modified one is used when bundling your .jar.
Now sign the app with
codesign --options runtime --entitlements entilement.plist --force --sign "Developer ID Application: Your_Name" path/to/your/bundle.app
For the entitlements you should use (save that to entilement.plist):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.disable-library-validation</key><true/>
<key>com.apple.security.cs.disable-executable-page-protection</key><true/>
</dict>
</plist>
With this, I managed to get an app signed and notarized (as part of a DMG), which is able to run on Intel and Apple Silicon Macs with macOS 10.9 or higher.
I am running:
jar2app -r jre1.8.0_221.jre -n TechnicLauncher -d TechnicLauncher -i Icons.icns -b com.amobiledevice.TechnicLauncher TechnicLauncher.jar
Where jre1.8.0_221.jre was extracted from jre-8u221-macosx-x64.tar.gz downloaded from Oracle. I have also tried:
jar2app -r "/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk" -n TechnicLauncher -d TechnicLauncher -i Icons.icns -b com.amobiledevice.TechnicLauncher TechnicLauncher.jar
Both produce the same error:
Running the command without the -r option works fine, but as soon as I try to bundle a java runtime it breaks.
Hi!
It is possible to include the jre only?
I've tried with the -r option, but the app won't start unless I include the full jdk.
Thanks
-u SIGNATURE, --unique-signature=SIGNATURE
4 Byte unique signature of your application (Default:
????)
---->>>
I got a cert from Apple as cert and created a p12 file too. Now, what to pass for the -u param?
Would u please share an example with a dummy literal?
In my project, I have 2 Binary files that must go on the same level as the .jar file. As without them, the .jar file will not execute. To fix this I moved the .bin files into the java folder, so the .jar file will run however the .app will still not run. Does something need to be changed in the info.plist?
"Unable to load Java Runtime Environment" dialog shows on execution of .app created.
I've hit a wall trying to upload apps created by jar2app to the app store. The complaint (from transporter) is that
it can't find the bundle id.
https://stackoverflow.com/questions/59761535/error-from-transporter-failed-to-get-the-apps-bundle-id
My hope, entering this as an issue for jar2app, is that it's some subtle and otherwise meaningless feature
of the app written by jar2app that is confusing transporter.
Here is the script I use to create the app, and bundle it for transporter.
#!/bin/csh
./jar2app boardspace.jar -i boardspace.icns -n "boardspace" -d "boardspace.net" -b "com.boardspace.app.launcher" -v 1.0
codesign -s "Developer ID" boardspace.app/Contents/MacOS/JavaAppLauncher
codesign -s "Developer ID" boardspace.app/Contents/Resources/boardspace.icns
codesign -s "Developer ID" boardspace.app/Contents/Java/boardspace.jar
codesign -s "Developer ID" boardspace.app
productbuild --component boardspace.app /applications --sign "Developer ID" --identifier com.boardspace.launcher.app boardspace.pkg
As the title says, could you add exe exporting functionality from jar2app but one that works in converting to an exe application? That would be amazing! (It is just a feature request.)
So, I have an image in my jar file called loading.gif. In my manifest file, there is an attribute: SplashScreen-Image: loading.gif
This works perfectly fine as a .jar file, but upon using jar2app, it stops working for some reason.
If I add the option -r ../openjdk11.jre
I will always get Unable to load Java runtime environment. However if I do not enter anything it will work.
Is there a workaround to get my version of java working on the app?
Is it possible to load a splash screen as well?
I get the following error message when bundling my jar:
OSError: [Errno 1] Operation not permitted: './Magikcraft.app/Contents/Resources/en.lproj/Localizable.strings'
There is a ./Magikcraft.app/Contents/Resources
folder in the output, but no en.lproj
one.
Simply put, can an option be put to set a minimum jdk and/or jre version?
Will this ever be added?
If you fancy installing jar2app using scoop, here's a manifest to to so: jar2app.json.zip
Just unzip it and run scoop install jar2app.json
. If python is not installed it will be downloaded and installed in the process
Note: this will install the latest version from the master branch. Since there is no versioning scheme, autoupdate is not possible; however you should be able to force an update using scoop update jar2app -f
.
Maybe it would be a good idea to submit a pull request to scoop's repo to have it included in the main bucket.
Directory Structure:
xxxx.jar data.db
Java code:
jdbc:sqlite:data.db
Run jar need data.db
Usejar2app XXXX.jar -j "-XstartOnFirstThread" -r /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk
。
Open app prompt error
not found data.db
Hello,
is it possible to add a folder that contains native libs?
For example I have a vm option for loading the files:
-Djava.library.path=.../nativeLibs/something.framework
Is it possible to add this nativeLibs
folder to the app config to be able to use it correctly?
Does this make sense?
Thanks!
is there any method to rename JavaAppLauncher to App Display Name?
I thought I'd give your program a try, but the install script doesn't appear to want to work. Here's what I've tried and their output:
apaches-iMac:Development apache$ git clone https://github.com/Jorl17/jar2app
Cloning into 'jar2app'...
remote: Counting objects: 62, done.
remote: Compressing objects: 100% (30/30), done.
remote: Total 62 (delta 30), reused 62 (delta 30), pack-reused 0
Unpacking objects: 100% (62/62), done.
Checking connectivity... done.
apaches-iMac:Development apache$ cd jar2app
apaches-iMac:jar2app apache$ ls
LICENSE install.sh jar2app_basefiles
LICENSING jar2app uninstall.sh
README.md jar2app.py
apaches-iMac:jar2app apache$ chmod +x install.sh uninstall.sh
apaches-iMac:jar2app apache$ sudo ./install.sh
Password:
mkdir: /usr/bin/jar2app_basefiles: Operation not permitted
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file ... target_directory
cp: /usr/bin/jar2app: Operation not permitted
chmod: /usr/bin/jar2app: No such file or directory
Those last few lines are the problem. I don't know what's going on. Any ideas?
Running Mac OS X El Capitan (10.11.6).
A user without a JDK installed reports this error when opening my app, built with a bundled JDK:
The command I used to build this file was:
jar2app magikcraftLauncher.jar Magikcraft -n "Magikcraft" -r /Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk -i icon.icns -b io.magikcraft.launcher
You can download the built here: https://s3.amazonaws.com/magikcraft-client/Magikcraft-MacOS.zip
It's a minecraft client launcher.
jar2app UserProxy.jar test -r jre1.8.0_111.jre/
Packing UserProxy.jar into /Users/macmini/Desktop/shit to sign/jartest/test.app
Traceback (most recent call last):
File "/usr/local/bin/jar2app", line 487, in
main()
File "/usr/local/bin/jar2app", line 485, in main
make_app(*parse_input())
File "/usr/local/bin/jar2app", line 434, in make_app
copy_base_files(app_full_path, icon, jar_file, jdk, jdk_isfile)
File "/usr/local/bin/jar2app", line 300, in copy_base_files
copy_jdk(app_full_path, jdk, jdk_isfile)
File "/usr/local/bin/jar2app", line 275, in copy_jdk
shutil.copytree(jdk, os.path.join(app_full_path, 'Contents', 'PlugIns', os.path.basename(jdk)))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 177, in copytree
os.makedirs(dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 17] File exists: './test.app/Contents/PlugIns/'
Looking at How to package extra files into app I see that the solution was to manually copy the desired file into the Contents directory. I would like to propose an additional terminal option to add a library folder.
Ex: jar2app XXXX.jar --additional-libs=/path/to/library/
The reason being is that there are occasionally JARs that have an external lib folder that is required for the JAR's execution such as MSGViewer. It makes sense to have it packaged along with it as a standard approach instead of extra steps seeing as it's necessary for core operation rather than an extraneous bit of data to be used by the JAR.
If you like the idea, I'll try to find some spare time to fork this repo and add it in myself.
Edit: Since this is for libraries/files to be used as dependencies for the JAR being added and the JAR usually looks in the CWD, the additions would go in the XXXX.app/Contents/Java/ folder rather than simply XXXX.app/Contents/ as it was done in the aforementioned issue.
I've jumped through most of the hoops to get my app into the apple app store; it works
fine if java is installed and jar2app doesn't specify a jvm. However, it seems unlikely that
apple will accept this. If I add a jvm with the -j, the .app no longer launches with the
quoted.
"unable to load java runtime environment"
I see traffic in other threads about the same problem, but no clear solutions.
As of recently Oracle has forced MacOS users to download JDK11 and not anymore 10.0.2, which is troublesome as the app created by jar2app (exactly the JavaAppLauncher) fails with JDK11 installed
Any update on whether JDK11 is on the roadmap to be supported?
I have been trying to figure out how to get around this error when your using your app. I am able to get it to output the jar but receive an error when attempting to run it. I have also signed the application as well to only have it result in the same error.
I have converted my file named myfile.jar, it works and becomes myfile.app. Unfortunately, when I open in my Mac (Big Sur 11.2) got an error. it says that I don't have permission ("You do not have permission to open the application "myfile". "). I know that I can solve this by changing its file permission by chmod 777, but I don't want anyone that I give my app, he/she doing the same thing, he/she will think it too complicated. So, can "jar2app" convert it and automatically give the permission to all?
thanks
I have packaged a java app for mac os but when I try to call the app with cmdlines (either via open command or by going directly into the app macos folder and running JavaAppLauncher with arguments) they are not forwarded to the java main method...
Doing via java -jar goldfinder.jar arg1 arg2
works.
Any Clue how to get this working? Is it a configuration issue or a feature?
I see that in the Macos folder is a javalauncher file. how is that used to launch the package jar? I also codesigned the resulting .app but still seem to have issues with gatekeeper not allowing the app to launch
Termination Reason: Namespace CODESIGNING, Code 0x1
how is the jar packaged and when it is, is it in conformance with gatekeeper on osx 10.12.1? I have been able to codesign this without problem but when attempting to launch or verifying with spctl it says it is rejected.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.