Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (763)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (852)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Stubbornly insisting on using JLINK for deployment  (Read 1557 times)
0 Members and 1 Guest are viewing this topic.
Offline philfrei
« Posted 2018-05-16 02:41:31 »

I've managed to write a working self-contained .exe for deployment, using the tool javapackager. I'm resisting deploying because I'd like to use the smaller runtime I made with JLINK.

The documentation on this is really difficult, imho. Maybe I am just being too stubborn (e.g., just package the complete runtime, or, learn ANT and try to follow the documentation on that path instead of javapackager).

Question for the more experienced folks at JGO:

1) How bad is it to have an app be, say, 180MB instead of 80MB? The app itself has a lightweight feel to it--maybe comprises 3MB of code. Are people who are willing to try plunking down $3 or $4 say going to be okay with this project size? (Down the road, I have some projects I was going to aim at $1. Will having a full JRE selfcontained with each be a problem for something this "small"?)

2) Does anyone happen to know if javapackager is even capable of deploying a jlink-generated runtime? (If you can answer this, consider also answering my question at Stack Overflow. Or, I can transfer the info over.)

So much whoop-de-do in books on Safari online about how the jlink runtime runs faster, can be used for more efficient deployments, etc., but I am unable to find one that details the actual deployment process for Windows (or any OS). And the "official" guide is a difficult read, confusingly organized, and relies deeply on Ant.

(SIDE ISSUE: Not entirely clear to me even how to use the .exe yet--the deployment guide and tutorials I have found don't give examples--they assume people already know that? But what if this is your first time? My result includes ToneCircleDrone-1.0.exe and a file folder with src and runtime. Now what?)

 Clueless

Thanks for any help.

music and music apps: http://adonax.com
Offline Spasi
« Reply #1 - Posted 2018-05-16 11:49:58 »

This works for me:

Quote
"%JAVA_HOME%\bin\javapackager" ^
-deploy ^
-native exe ^
-outdir RELEASE ^
-srcdir . ^
-srcfiles config.json ^
--module-path target/modules ^
--add-modules java.management,jdk.naming.dns,java.security.jgss ^
--module net.webhotelier.avl/net.webhotelier.avl.Main ^
-name "WHJA" ^
-vendor "WebHotelier" ^
-v ^
-BjlinkOptions="compress=2"

I get a WHJA-1.0.exe in the RELEASE folder, which is a native Windows installer. When installed, the app folder contains config.json & WHJA.cfg, the runtime folder contains the jlinked runtime.

I wasted too much time on this and it feels like javapackager and jlink are not integrated as well as they ought to. The issues I have identified:

1. javapackager's --module-path acts weirdly. I had to put all modular jars in the same directory for it to work. With jlink I can mix directories & individual jars in the same path without problems.
2. I had to use the undocumented -BjlinkOptions to get a jlink minimized image. Without it I get a smaller installer (~18MB), but the installed application contains all modules (~107MB total). With compress=2, I get a bigger installer (~37MB), but the installed application contains only the modules necessary (~51MB total).
3. It's impossible to pass multiple jlink options (e.g. both --compress=2 and --no-header-files). Had a look at the source and it looks like a bug in javapackager's argument parsing.

If I were you, I'd use jlink directly and bundle the resulting image with a third-party solution to create the native installers/executables. Note that the Java Packager tool has always been part of JavaFX, which means a) don't expect software quality excellence and b) its future is questionable.
Offline philfrei
« Reply #2 - Posted 2018-05-16 18:00:55 »

@Spasi -- I'd like to give you multiple appreciations for answering!

For a 3rd party, I guess I'll take a look at Inno Setup and WiX first. I'll have to figure out what their differences are--both are required for the .exe deployment by the Java Packaging tool, according to the Deployment Guide.

If you have another preference, would like to hear about it. My experience with JSmooth though was that I couldn't get past the sparse and ambiguous documentation. Maybe it is me, that everything I read tends to look like a funhouse hall of mirrors and it takes a great deal of effort to nail things down.

Can I ask what the JSON file you have for srcfiles consists of?

Thanks again!

music and music apps: http://adonax.com
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline nsigma
« Reply #3 - Posted 2018-05-16 18:17:27 »

For a 3rd party, I guess I'll take a look at Inno Setup and WiX first. I'll have to figure out what their differences are--both are required for the .exe deployment by the Java Packaging tool, according to the Deployment Guide.

I thought it was one or other?!  Undecided

Just changed to using InnoSetup for PraxisLIVE - found it really simple to set up by itself, and I like that I can run it / script it with WINE!  Cool

Praxis LIVE - hybrid visual IDE for (live) creative coding
Offline philfrei
« Reply #4 - Posted 2018-05-16 18:19:33 »

Quote
3. It's impossible to pass multiple jlink options (e.g. both --compress=2 and --no-header-files). Had a look at the source and it looks like a bug in javapackager's argument parsing.

I found a book on Safari, "Java 9 Revealed" author Kishori Sharan 2017, which lists the syntax for this.

1  
2  
3  
4  
5  
6  
7  
jlink <options> --module-path <modulepath> --add-modules <mods> --output <path> 

-c, --compress <0|1|2>[:filter=<pattern-list>]

--no-header-files

--no-man-pages


This implies that these can be space-delimited at the front end of the javapackager command (prior to --module-path). Did you try this exact ordering? (I'm guessing you did, but on the off chance this might still be relevant...)

music and music apps: http://adonax.com
Offline Spasi
« Reply #5 - Posted 2018-05-16 19:37:27 »

If you have another preference, would like to hear about it.

We're using jlink, compressing the result, then deploying that to servers, so I don't have experience with installers. But I know there are plenty of (free & commercial) options you could try.

Can I ask what the JSON file you have for srcfiles consists of?

Nothing special, just some settings for the application. It was a test to see how you may add random files to a bundle, in addition to the modular stuff.

Did you try this exact ordering? (I'm guessing you did, but on the off chance this might still be relevant...)

The problem is that javapackager does not call jlink (the cli command) internally, it uses the jlink API directly. The user arguments to jlink are supposed to be a key/value map, but parsing is broken somehow and you can effectively pass a single argument only.
Offline gouessej
« Reply #6 - Posted 2018-05-17 22:57:06 »

I use NSIS-Ant in JNDT, maybe it could be useful for you.

Julien Gouesse | Personal blog | Website | Jogamp
Offline philfrei
« Reply #7 - Posted 2018-05-17 23:57:28 »

Thanks gouessej. I'm feeling rather stupid at the moment, but I may have this solved.

Really stupid.

I was taking Spasi's advice and nsigma's encouragement to use Inno Setup. But I totally missed that all you have to do, to run it, is click the "Inno Setup Compiler" and a Wizard is offered.  Roll Eyes

Maybe it was a side effect of all that command-line stuff I was doing with module-compilation and jlink and attempts to use javapackager. The notion that there would be a Wizard didn't occur to me.

OK, still have to figure out how to include all the file folders needed. Heading back in for more.

EDIT1: Now, only hitch is that the .bat file that launches the app is being copied to the top folder location in the target set of folders. Should be a solvable problem.

EDIT2: Easy work-around. Write a new .bat and place it in the /dist folder created by JLINK. Have this .bat simply call the .bat file in dist/bin that kicks things off.

OK. Next step, tighten up the JLINK command. Also, have to set up a zip of the .xml files which provide content, that can be downloaded. Still some tasks to do. Feels weird not being totally blocked any more and able to make some real progress.

music and music apps: http://adonax.com
Offline nsigma
« Reply #8 - Posted 2018-05-21 09:52:49 »

I was taking Spasi's advice and nsigma's encouragement to use Inno Setup. But I totally missed that all you have to do, to run it, is click the "Inno Setup Compiler" and a Wizard is offered.  Roll Eyes

Maybe it was a side effect of all that command-line stuff I was doing with module-compilation and jlink and attempts to use javapackager. The notion that there would be a Wizard didn't occur to me.

Yes, the UI and wizards are useful, and it can still be used from the CLI / embedded in your build later when it works (eg. lots of resources for setting up with Ant).  I looked at NSIS too, but didn't appeal, and as soon as I figured I could use InnoSetup just as easily on Linux and in the build system it was a no brainer.  Smiley

Something wrong in your setup though if you're having to move things around to get them to work.

Praxis LIVE - hybrid visual IDE for (live) creative coding
Offline princec

« JGO Spiffy Duke »


Medals: 1041
Projects: 3
Exp: 20 years


Eh? Who? What? ... Me?


« Reply #9 - Posted 2018-05-21 11:16:17 »

er wut? InnoSetup works on Linux?

Cas Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline nsigma
« Reply #10 - Posted 2018-05-21 18:16:04 »

@princec - as earlier message, with WINE, yes.  Wink  I think it works fine on macOS that way too.  There's various ways of then using it within a build system, executing the build script via WINE without UI.  AFAIK, there's also a Linux tool for extracting the binaries from its installer directly (without running it).  I've read a few posts of people then setting it up within travis-ci, etc. - not got that far yet!  Cheesy

Praxis LIVE - hybrid visual IDE for (live) creative coding
Offline gouessej
« Reply #11 - Posted 2018-05-21 22:17:11 »

NSIS works under GNU Linux too and I use it with Ant.

Julien Gouesse | Personal blog | Website | Jogamp
Offline philfrei
« Reply #12 - Posted 2018-05-22 05:02:35 »

You are all quite over my head on this!

I'm just happy to have (a) figured out the dang commands to get the icons to show correctly. The examples in INNO SETUP extract icons from within the .exe, which is not exactly helpful for the JLINK situation, since JLINK creates a .bat not an .exe; (b) figured out how to keep the command shells minimized. I'm not running a single copy in full-screen, but am allowing (expecting) multiple iterations to run at the same time and don't want the screen cluttered with DOS shells.

It only took four days.   Tongue


music and music apps: http://adonax.com
Offline princec

« JGO Spiffy Duke »


Medals: 1041
Projects: 3
Exp: 20 years


Eh? Who? What? ... Me?


« Reply #13 - Posted 2018-05-22 08:45:37 »

Hi Julien - thanks for mentioning that about NSIS, I had no idea it ran under Linux. NSIS is great, if a little old-fashioned in its scripting language.

Cas Smiley

Offline nsigma
« Reply #14 - Posted 2018-05-22 09:04:32 »

NSIS is great, if a little old-fashioned in its scripting language.

Yes, NSIS works natively under Linux, but that scripting language! persecutioncomplex I did mention that earlier, Julien, but as soon as I figured out how easy Inno Setup worked via Wine libs I was happier with that.

@philfrei - I assume you've found the online docs for Inno Setup, or are they available in the app too?  I also had to do the icons thing, although NetBeans RCP uses an .exe so no need for the minimize.  Isn't there a way to alter the script so that the console window closes as soon as the JVM is up?  Sure I've seen that somewhere.

If it's of interest, I just pushed my initial iss file to GitHub.  It works - I'm not sure it's good!  Grin  One thing I did do, relevant to what you said earlier, is comment out the line that copied the launcher into the root folder, and just copy across all the subfolders - editing the icon links to match.

Praxis LIVE - hybrid visual IDE for (live) creative coding
Offline Spasi
« Reply #15 - Posted 2018-05-22 09:18:19 »

since JLINK creates a .bat not an .exe; (b) figured out how to keep the command shells minimized.

Isn't there a way to alter the script so that the console window closes as soon as the JVM is up?

I forgot to mention that we don't use the .bat/.sh script that jlink generates. It's very minimal and there's basically no way to make jlink generate anything interesting in it (e.g. you'd need to manually edit to set JLINK_VM_OPTIONS). The service launcher just runs the java executable with the appropriate arguments.
Offline philfrei
« Reply #16 - Posted 2018-05-22 16:32:18 »

nsigma wrote:
Quote
@philfrei - I assume you've found the online docs for Inno Setup, or are they available in the app too?  I also had to do the icons thing, although NetBeans RCP uses an .exe so no need for the minimize.  Isn't there a way to alter the script so that the console window closes as soon as the JVM is up?  Sure I've seen that somewhere.

Thanks for checking back on those issues, nsigma.

Yes, the examples and docs are packed with the application and I did find them.
Yes, one can add "runminimized" as a "Flag" for the "Icon" tag. I didn't see an example, though, since I didn't take the time to locate any examples that run a bat.

There should be a common scale for documentation quality. Maybe this (scale of 1-5):

1) no doc or contains many inaccuracies (worse than none?)
2) many gaps (includes: references to things not explained)
3) relatively complete info but not well organized, sparse examples
4) able to index in, locate specific issues/scenarios
5) info works for scanning/speed-reading intake (with clear drill-down paths and easy to locate examples)

6!) your specific scenario has been anticipated and dealt with

I would place INNO SETUP 5 at about 3.5 on this scale.

But, such a scale being linear, and problems being orthogonal to each other, the scale has its drawbacks.

music and music apps: http://adonax.com
Pages: [1]
  ignore  |  Print  
 
 

 
EgonOlsen (553 views)
2018-06-10 19:43:48

EgonOlsen (657 views)
2018-06-10 19:43:44

EgonOlsen (452 views)
2018-06-10 19:43:20

DesertCoockie (790 views)
2018-05-13 18:23:11

nelsongames (1025 views)
2018-04-24 18:15:36

nelsongames (1058 views)
2018-04-24 18:14:32

ivj94 (1637 views)
2018-03-24 14:47:39

ivj94 (562 views)
2018-03-24 14:46:31

ivj94 (1445 views)
2018-03-24 14:43:53

Solater (567 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!