Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bundled Java runtime #770

Merged
merged 136 commits into from
Oct 5, 2021
Merged

Add bundled Java runtime #770

merged 136 commits into from
Oct 5, 2021

Conversation

tresf
Copy link
Contributor

@tresf tresf commented Mar 9, 2021

Closes #468

Bundles the Java Runtime into a the QZ Tray installer.

  • To skip bundling, use new parameter${jre.skip}
    ant pkgbuild -Djre.skip=true # skip bundling of Java Runtime
  • Since Initial support for M1 CPU #783 allows JavaFX to be fetched for non-x86_64 architecture by providing new jre.arch parameter. e.g:
    ant pkgbuild -Dtarget.arch=aarch64 # Grab and bundle ARM64 Java Runtime + JavaFX
    See also b40dd01.
  • Downloads Java for the architecture requested (or detected) matching the vendor hard-coded into JLink.
  • Java will now live in a nested folder:
    OS Path
    🪟 Windows C:\Program Files\QZ Tray\runtime\bin\java.exe
    🐧 Linux /opt/qz-tray/jre/runtime/java
    🍏 MacOS /Applications/QZ Tray.app/Contents/PlugIns/Java.runtime/Contents/Home/bin/java

TODO:

  • Update tutorials, don't assume java -jar is a valid command.

* Adds JLink helper class, CLI support
* Refactor main(); untangles TrayManager and PrintSocketServer
* Force openjdk@11 on Travis + macOS
* Mimic javapackager structure for macOS
* Temporarily disable clean between builds
* Temporarily allow running Mac version from out

Co-authored-by: Berenz <[email protected]>
Co-authored-by: Vzor- <[email protected]>
@klabarge
Copy link
Member

klabarge commented Sep 1, 2021

I get the below error during installation on Ubuntu 16.0.4

QZ Tray is starting...
[INFO] 2021-08-31 19:10:23,401 @ qz.installer.Installer:?
	Fixing runtime permissions...
[INFO] 2021-08-31 19:10:23,407 @ qz.installer.Installer:?
	Stopping running instances...
[DEBUG] 2021-08-31 19:10:23,434 @ qz.utils.ShellUtilities:?
	Executing: [pgrep, -x, java]
[DEBUG] 2021-08-31 19:10:23,461 @ qz.utils.ShellUtilities:?
	Executing: [pgrep, -f, qz-tray.jar]
      [success] Task preinstall was successful
Running install task...
Looking for Java...
   [success] Java was found: /tmp/selfgz7723/runtime/bin/java
Verifying the Java version is 1.8+...
   [success] Java 11.0 was detected
   [success] Java >= 9.0, adding jigsaw options
QZ Tray is starting...
[INFO] 2021-08-31 19:10:24,080 @ qz.installer.Installer:?
	Installing to /opt/qz-tray
[ERROR] 2021-08-31 19:10:24,126 @ qz.utils.ArgParser:?
	Installation step INSTALL failed
java.io.FileNotFoundException: /tmp/selfgz7723/Java.runtime/Contents/Home/legal/java.desktop/ADDITIONAL_LICENSE_INFO (No such file or directory)
	at java.base/java.io.FileInputStream.open0(Native Method)
	at java.base/java.io.FileInputStream.open(Unknown Source)
	at java.base/java.io.FileInputStream.<init>(Unknown Source)
	at org.apache.commons.io.FileUtils.doCopyFile(FileUtils.java:1138)
	at org.apache.commons.io.FileUtils.doCopyDirectory(FileUtils.java:1428)
	at org.apache.commons.io.FileUtils.doCopyDirectory(FileUtils.java:1426)
	at org.apache.commons.io.FileUtils.doCopyDirectory(FileUtils.java:1426)
	at org.apache.commons.io.FileUtils.doCopyDirectory(FileUtils.java:1426)
	at org.apache.commons.io.FileUtils.doCopyDirectory(FileUtils.java:1426)
	at org.apache.commons.io.FileUtils.doCopyDirectory(FileUtils.java:1426)
	at org.apache.commons.io.FileUtils.copyDirectory(FileUtils.java:1389)
	at org.apache.commons.io.FileUtils.copyDirectory(FileUtils.java:1261)
	at org.apache.commons.io.FileUtils.copyDirectory(FileUtils.java:1230)
	at qz.installer.Installer.deployApp(Unknown Source)
	at qz.installer.Installer.install(Unknown Source)
	at qz.installer.Installer.install(Unknown Source)
	at qz.utils.ArgParser.processInstallerArgs(Unknown Source)
	at qz.utils.ArgParser.intercept(Unknown Source)
	at qz.App.main(Unknown Source)
      [failure] Task install failed.

@tresf
Copy link
Contributor Author

tresf commented Sep 1, 2021

@klabarge the error you've linked seems to be a very odd issue with ant's inability to remove two types of files:

  • Symbolic links
  • .DS_Store files

This isn't documented very well in ant's documentation so it took a while to find, but for now, I've written a workaround to just get rid of these symlinks from the source as well as to always delete .DS_Store files: f40bb1e.

This means you'll need to run ant clean once, and then the Java.runtime folder pollution should stop. 😅 I found a few other edge-case issues with the build system and they've been patched as well.

@tresf tresf merged commit c0e20f3 into master Oct 5, 2021
@tresf tresf deleted the jlink branch October 5, 2021 04:52
@tresf tresf mentioned this pull request Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bundled Java Runtime
5 participants