JavaPackager | Maven plugin to package Java applications | DevOps library
kandi X-RAY | JavaPackager Summary
kandi X-RAY | JavaPackager Summary
JavaPackager is a hybrid plugin for Maven and Gradle which provides an easy way to package Java applications in native Windows, Mac OS X or GNU/Linux executables, and generate installers for them. SNAPSHOT version is not released to Maven Central, so you have to install it manually. :eyes: See JavaPackager changes and fixes.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Apply the JRE to a package
- Gets required modules
- Convert additional module paths to parameters
- Apply zip file to pack
- Creates a tar file from the packager
- Applies the manifest to the packager
- Creates the assets
- Performs the actual installation
- Apply the dependencies to the packager
- Generates the tar file
- Creates a zip file
- Apply mac
- This method gets the application and generates AppImageTool
- Generate the velocity file
- Set a parameter with the given value
- Creates the android app
- Generate the MSPack file
- Creates the app structure
- Try to locate a license from a packager
- Apply the velocity file to the assets folder
- Creates a windows EXE file
- Region CreateWindowsExe
- Performs the actual install
- Creates a native Java app bundle
- Creates the actual manifest files
- Performs the actual packager
JavaPackager Key Features
JavaPackager Examples and Code Snippets
Community Discussions
Trending Discussions on JavaPackager
QUESTION
I saw this stack overflow post to know how to create executable files from java source , where it says to use javapackager
he also says that it is included with Java JDK but I dont have any clue of how to use it.
I read this oracle documentation but still didn't get much how to create native type .exe file for my code like I tried it on cmd and it says javapackager is not a valid command , I found these ways old so How can I make a .exe file for my java code now .
ANSWER
Answered 2021-Apr-28 at 12:26javapackager
was removed from the JDK. The recommended way is now (It is better,if you have a modular application) to use jlink and/or jpackage
QUESTION
Does anyone know what the * following a filename in macOS terminal means?
All the file names in the folder:
/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands
have a * trailing them and I'm not sure why.
For example:
...ANSWER
Answered 2020-Sep-28 at 01:30As for the executable-looking emulator that you can't actually execute, this can happen when the dynamic loader requested by emulator doesn't exist. You can check what kind of file emulator is with the command file emulator, and check what dynamic loader and libraries it needs with ldd emulator (any line showing “not found” is something you need to install). Given the name of the directory and the size of the file, emulator is probably a Linux x86 binary. I suspect you have an amd64 system. If so, you need to install a runtime environment for 32-bit applications; on Ubuntu, you need the ia32-libs package (and perhaps also ia32-libs-gtk). You could also get this error message for a script whose interpreter as indicated in the #! line doesn't exist.
same question here.
QUESTION
I package a JavaFX application using maven and OpenJDK 1.8 The relevant part from my pom.xml:
...ANSWER
Answered 2019-Oct-08 at 16:46Short answer
I ran my jar with openJDK 11 which does not include JavaFX while building it with openJDK 8. Case closed.
Findings, details and reasons
Since my IDE was able to run my code without issues, I presumed the problem to be specific to my config/machine. As it turns out Canonical/Ubuntu decided
[For] Bionic [...] move the default JRE/JDK in main to OpenJDK 11 in September/October 2018 as an SRU. AskUbuntu
And, as pointed out on a different SO Thread:
JavaFX 11 is not part of the JDK anymore StackOverflow
(This also includes instructions how to fix this with JDK 11)
And finally, as Murphy's law had it, I set up my packaging the project on October 4th, and decided to install eclipse via apt on October 8th which includes openjdk-11-jdk:amd64
(this is logged in the useful /var/log/apt/history.log
).
This also updated my /etc/alternatives/java
to point to v11. Since I ran my jar without explicitly specifying the java binary, it broke.
Running
QUESTION
I have JavaFx ShowTime.jar and config folder. To run the software, the config folder needs to be in a same directory as ShowTime.jar. In side the config folder, there are two folders : preferences and plugins.
I can bundle the config folder with the jar using the following codes:
...ANSWER
Answered 2019-Aug-27 at 09:34That's not how applications normally work. Modifiable configuration items are normally held in a separate user-specific folder. The name and location of this folder is in general different for each OS but a relatively common approach is to place an invisible folder inside the home directory of the user. Something like ".MyApplication" for example. This folder and its initial content has to be created by your software when the application is started for the first time. When a new version of the software is installed you may keep this folder because it is not overwritten by the installer.
QUESTION
when we create jlink runtime images we can use tags such as '--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages' , creating a distribution folder around 45mb.
If we want to use javapackager, for example to create an .DMG file, how can we do a similar compression? since these tags are not avaiable for javapackager. Without them the final bundle is around 100mb, losing a lot the java9 modularization advantages, so my question is if it is possible to use javapackager with JRE runtime images created by jlink.
thanks
...ANSWER
Answered 2017-Nov-15 at 16:07Answering my own question, we can just use the combination of two:
For MacOSX example:
1) generate a runtime dist with jlink, this will create a lib folder with around 50mb if you use compress tags.
2) Generate MacOSX.app with javapackager, this .app will come with a runtime lib folder around 98mb.
3) Simple replace them, right click MacOSX.app-> "show package contents", then go to Plugins/Java.runtime/Contents/Home/ and replace lib folder with the one generated by jLink.
This way you have a self-contained Java app with around 50mb instead of 100mb, thanks to beautiful Java9 modules.
Would be cool to do all of this just with javapackager, if it's possible I couldn't find how, I suggest to use something like gradle to execute all this process with 1 command.
QUESTION
I was able to use ZuluFX 8 with javapackager on Windows. However, on a Mac I get this error:
Bundler Mac Application Image skipped because of a configuration problem: Cannot determine which JRE/JDK exists in the specified runtime directory.
Advice to fix: Point the runtime directory to one of the JDK/JRE root, the Contents/Home directory of that root, or the Contents/Home/jre directory of the JDK.
It's pretty easy to just move the package into Contents/Home
but I doubt that will work as it seems there is no JRE bundled with the Mac version of ZuluFX 8. Is this something that can be worked around?
ANSWER
Answered 2019-Mar-17 at 01:34It's pretty easy to just move the package into Contents/Home but I doubt that will work as it seems there is no JRE bundled with the Mac version of ZuluFX 8.
From what I'm seeing, I'm not sure that's correct. The ZuluFx 8 archive for Mac contains a jre
directory. I extracted the archive to ~/zuluFX
and from there created the Contents/Home
directory as required by MacOS and added a symbolic link to said jre
directory there. I then set $JAVA_HOME accordingly:
QUESTION
- I built a small app using javafx ( very basic stuff )
- compile using javac : OK ( oracle jdk 1.8.0_201-b09 )
- crated the jar : OK : the jar works fine with java -jar
packaged the app using javapackager
javapackager \ -deploy \ -daemon \ -srcfiles $JAR_FILE:./lib/$LIB_JAR.jar \ -outdir $DIST_FOLDER \ -outfile dist \ -native deb \ -appclass com.myapp.client.gui.Main \ -name "MyApp" \ -title "MyApp" \ -v
run the generated deb installer ( same machine )
- go the the installed app under /opt/MyApp, and when I ran
MyApp
it just complains aboutGLIBCXX_3.4.21
not found
I have tried all sort of apt fixes but nothing worked..
it's worth mentioning that this is all done in a fresh ubuntu desktop version running from a virtual machine. ( ubuntu 14.04.1 amd64 )
...ANSWER
Answered 2019-Feb-11 at 15:44Try with jdk8u181 or less. The provided launcher from the jdk (in lib/ant-javafx.jar -> ./com/oracle/tools/packager/linux/JavaAppLauncher ) doesn't have the same symbol tables. It looks like a bug in oracle's jdk compilation and distribution system.
QUESTION
I'm trying to package a java application using java packager tool ( I'm new to this tool ) the app itself has to make some calls internally ( using the java process api )
This works fine if the java application is started with admin privileges. for example if I run my jar app as sudo java -jar application.jar
from then all sub processes become admin as well.
For distribution purpose , I do not have control over how the users will start the app. thus trying to use java packager tool- but I need to enforce that the app is ran with admin privileges. ( fine the app will stop if the user does not have sudo for example )
The other workaround , which I strongly want to avoid is to ask the user to enter their admin/sudo password when I launch the internal processes..
---EDIT--- I think I needed to add more background after the comments and answer I got. as it looks to though the issue is about detecting admin or not.. this is not not what my issue is.
...ANSWER
Answered 2019-Jan-30 at 06:42This is a sample implementation of Detect if Java application was run as a Windows admin with a little extra to indicate how I imagine it could work.
MainClassThis is the "launcher" if you will. It's ´main´ method checks for admin privileges. if they are present, the "Real" class is called with the arguments provided. The program will run in the exact jvm.
If not, The user is prompted with a "this application needs admin privileges to run" message
QUESTION
I develop and distribute a Java Swing app that uses Apache Batik and JavaCV. I've updated it through java 1.6, 7 and 8. Installers for macOS, Windows and Linux are built with Javapackager. Java 8 is end of support in Jan '19 and I can't find a solution to package and distribute at Java 11, the new LTS version.
Neither JavaCV or Batik produce modular jars but I have managed to repackage them to the point where I can compile and produce a runnable jar at Java 11, app works fine but I can't package it for distribution. I was planning dropping to Java 10 to use javapackager and bundle the 11 runtime from there but it uses jlink to produce a custom runtime, jlink fails because JavaCV and Batik aren't modular. jdeps won't produce a module-info.class to patch in and make them modular due to unsatisfied references in Batik and JavaCV, even though my app works fine without them.
As a result I'm going to have to leave the code base at Java 8, and ship it even though no longer supported.
I know there's a call to create a replacement for javapackager but that won't be there until way after Java 8 is deprecated. And I'd still need Batik and JavaCV projects to refactor and build modular jars to produce a custom runtime.
Can anyone offer any other solution please? Have I missed something? Thanks.
...ANSWER
Answered 2018-Dec-05 at 20:45So the only solution was to write a wrapper app that uses ProcessBuilder to launch the original apps jar.
Advantage in this is that link can be used to produce the minimal required runtime. Place the jar in the bin directory, then use FPM (https://github.com/jordansissel/fpm) to create an installer.
Sample code for the wrapper
QUESTION
After long struggle I managed to generate (using Ant) on MacOSX (Yosemite) a DMG (of modular JavaFX application that deploys to *.app
folder) even with custom icons of the app and DMG volume (both stored as *.icns
files in build's package/macosx
folder). Drag and drop works, it installs the app, the app launches so everything is fine. Well, almost.
I was tempted to make also the custom background for DMG. It is placed together with the icons in package/macosx
folder as App-background.png
file (where App
part is the name of my app, as it is with icons). And javapackager
actually picks up the background, but unfortunately after opening DMG the background seems to be placed in windows' top-left corner, the window itself is like twice the size of the background, so 3/4 of the window's background is just white.
I tried with different PNG sizes, but to no avail. DMG window is always way bigger than the image.
Is there any way to make javapackager
(aka fx:deploy
which I actually use) to generate DMG with proper settings, that just make the DMG window fit background size?
Edit: It seems like DMG window has actually the size of the PNG (the original background file), but for some reason the image, when displayed as background, is "slightly" scaled down.
...ANSWER
Answered 2018-Nov-12 at 23:20After long investigation I found the (not so obvious and rather not direct) reason for this misbehavior. Fortunately I found also the solution.
Apparently there's some problem with Finder handling PNG while displaying DMG file. It all comes down to chunk pHYs
which contains 3 fields (4b, 4b and 1b long respectively). It is pixels per unit on x axis, pixels per unit on y axis and 0 or 1 for unit (0 no unit, 1 a meter unit). Playing with these values (via hex editor) did change somehow scaling behavior (and window size), but I wasn't able to figure out correct values. Eventually I get rid of this chunk completely (exporting from GIMP as PNG without saving resolution) and that solved the case.
So for anyone struggling with this: just make sure, there is no pHYs
chunk in PNG file.
Edit: One can do that easily with ImageMagick:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install JavaPackager
Download source code and change to the project directory:
Compile, package and install the plugin in your local repository (ommit ./ on Windows):
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page