jpackage ROOTDIR variable in a Windows bat file

Michael Hall mik3hall at gmail.com
Mon Nov 25 03:41:35 UTC 2019



> On Nov 23, 2019, at 11:45 AM, Michael Hall <mik3hall at gmail.com> wrote:
> 
> 
> 
>> On Nov 23, 2019, at 11:22 AM, Kevin Rushforth <kevin.rushforth at oracle.com> wrote:
>> 
>> I just tried this and it worked fine for me:
>> 
>> jpackage --java-options '-Djava.security.policy=$APPDIR/all.policy' ...
>> 
>> (note that there should not be an extra "/app" since $APPDIR points to the app directory).
>> 
>> It generated this in the ApplicationName/app/ApplicationName.cfg file:
>> 
>> [JavaOptions]
>> -Djava.security.policy=$APPDIR/all.policy
> 
> Maybe something is different about running from a bat. Or I’m missing a typo or something. 
> Command line it seems to get past that error but gets…
> 
> Can not find WiX tools (light.exe, candle.exe)
> Download WiX 3.0 or later from….
> Error: Invalid or unsupported type: [null]
> 
> This is from a VirtualBox Windows 10 64bit virtual machine. 
> 
> The bat file continues to get the same error. I’ll look closer to be sure it isn’t an error in my bat. 
> 
> On OS X, yes APPDIR works when I remove ‘app’ from the path as you indicated.

To follow up on this a little bit. 

I installed the indicated Wix. This in turn required a .Net framework of I believe 3.5.1. I tried the latest it still didn’t work. I installed the exact version indicated and it did work, Wix then installed.

I got a command line invocation to run through but still not entirely successful. If I remember right it indicated something about the installed incubator runtime not being suitable to run the application. I probably should of followed up immediately but didn’t. Sorry, about being sort of vague here. I do sort of wonder about this being a Windows jpackage dependency. I recently saw I think you on javafx mention that you didn’t like depending on 3rd party libraries?

I got to thinking that I needed something better than the bat file I was using that wasn’t working at all. It occurred to me I could try doing something with my own application which is a java shell intended to invoke things like jpackage. This got me looking closer at the jpackage parameters including @filename. This seemed a simple and effective way to do what my bat file was supposed to. Also what I am thinking of adding to my app. I tried this on Windows.

--input ./HalfPipe.app/Contents/app 
--install-dir ./outputdir 
--name HalfPipe 
--runtime-image "c:/Program Files/Java/jdk-14" 
--main-class us.hall.hp.common.LoaderLaunchStub 
--add-modules java.compiler,java.desktop,java.logging,java.management,java.prefs,java.se,java.rmi,java.scripting,java.sql,java.xml,jdk.attach,jdk.jshell 
--java-options '-Xmx1024m -Djava.security.policy=$APPDIR/all.policy -Dconsole=pane' 
--main-jar halfpipe.jar

Notice the exclusive use of forward slash as per your earlier. This is run against a successfully built OS X version of the app. This currently gets…

C:\Users\mik3h\Documents\halfpipe_port>jpackage @jpkg.txt
WARNING: Using incubator modules: jdk.incubator.jpackage
java.nio.file.FileAlreadyExistsException: C:\Users\mik3h\AppData\Local\Temp\jdk.incubator.jpackage13266515172329575129\images\win-msi.image\HalfPipe\app\HalfPipe.cfg

Possibly a simple error on my part but it is not yet clear to me what.







More information about the core-libs-dev mailing list