Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Al Hobbs
  • salvin francis

Maven - Bundled JRE and javaFX

Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Im building a small app in JavaFX using maven and openJDK 12. However, I need my .Jar to contain a bundled JRE so it can run on windows OS without downloading a proper JRE.

Im also using launch4j-maven-plugin

I tried several solutions here and on SOF but no success.

The current code I have, do the job partially :

  • It packs the "C:/Program Files/Java/openjdk-12.0.2_windows-x64_bin/bin" folder inside the .jar but the ".exes" arent included, which is bad.

    It packs the dependencies of POM inside the .jar

    launcher4j-maven packs it all in a .exe

  • What I want is to pack the JRE inside the .jar and set launcher4J to use it. Would someone help me? I need this too because javaFX actually is being a pain to execute in users/clients computers.

    Saloon Keeper
    Posts: 24557
    Android Eclipse IDE Tomcat Server Redhat Java Linux
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I think you're out of luck. A JAR is just a special form of a ZIP file, so first you'd have to be able to execute a Windows .exe from the command line or GUI desktop while it's contained within the ZIP. Not possible unless something essential changed in Windows.

    Secondly, a JRE is more than just the "javaw.exe". It's the aggregate of the executable VM, the core libraries, the internal configuration files, and a whole lot more. All of which have to be accessible via direct filesystem I/O calls. Which is to say, that they have to be files, not be in a file (ZIP).

    Thirdly, if you're bundling Oracle's JRE into anything without licensing, you could expect to hear from their rather formidable legal department, technical obstacles notwithstanding.
      Bookmark Topic Watch Topic
    • New Topic