jpackage producing non-working binaries on Windows

Tom Anderson twic at urchin.earth.li
Thu May 2 20:02:09 UTC 2019


Hi Kevin,

Aha! That explains it, and yes, adding that flag fixes the issue. Thanks!

The only documentation i have seen is this:

https://openjdk.java.net/jeps/343

And while that does mention this flag, the mention is deep in the section 
describing all the flags, which i have to confess i did not read in 
detail. When jpackage graduates to a production JDK, i would encourage 
that option to be given a bit more prominence.

Regards,
tom

On Thu, 2 May 2019, Kevin Rushforth wrote:

> You need to run jpackage the "--win-console" option in order to get a console 
> app. This is intentional and documented.
>
> -- Kevin
>
>
> On 5/2/2019 9:19 AM, Alexey Semenyuk wrote:
>> Hi Tom,
>> 
>> Thank for providing a reference to the demo project and build output.
>> 
>> In your example you use jpackage to produce an application image, not an 
>> exe or msi installers. Just to be clear on the test scenario.
>> 
>> Test app prints "Hello, world!" to stdout as far as I can tell from 
>> https://github.com/tomwhoiscontrary/jpackage-demo/blob/master/src/main/java/demo/App.java
>> I think I understand why there is no output when the app is launched by 
>> executable produced by jpackage. To make stdout and stderr streams work as 
>> expected Windows application should explicitly allocate a console by 
>> calling corresponding win api or be linked as console app. None is the case 
>> with executables produced by jpackage. This looks like a bug.
>> 
>> If you have something like
>> ---
>> package demo;
>> 
>> import javax.swing.*;
>> 
>> public class App {
>>     public static void main(String args[]){
>>         JFrame frame = new JFrame("My First GUI");
>>         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
>>         frame.setSize(300,300);
>>         JButton button1 = new JButton("Press");
>>         frame.getContentPane().add(button1);
>>         frame.setVisible(true);
>>     }
>> }
>> ---
>> 
>> in your test app you should see some output though.
>> 
>> - Alexey
>> 
>> On 5/2/2019 7:14 AM, Tom Anderson wrote:
>>> Hi Alexey,
>>> 
>>> Here is a demo project:
>>> 
>>> https://github.com/tomwhoiscontrary/jpackage-demo
>>> 
>>> If i run this on Windows (Windows 10 in a VM), it produces this output:
>>> 
>>> https://gist.github.com/tomwhoiscontrary/ee33dda3c124d8a67bd5bba5b8d5e32d 
>>> 
>>> Which includes the following command line:
>>> 
>>> [create-app-image, --name, demo, --input, 
>>> C:\Users\IEUser\Downloads\jpackage-demo-master\jpackage-demo-master\build\libs, 
>>> --output, 
>>> C:\Users\IEUser\Downloads\jpackage-demo-master\jpackage-demo-master\build/app-image, 
>>> --main-jar, jpackage-demo.jar]
>>> 
>>> I should note that i am running the build using JDK 11, then using the 
>>> early access JDK 13 only to run jpackage at the end.
>>> 
>>> Regards,
>>> tom
>>> 
>>> On Wed, 1 May 2019, Alexey Semenyuk wrote:
>>> 
>>>> Hi Tom,
>>>> 
>>>> What is your jpackage command line? Could you please rerun it with 
>>>> JPACKAGE_DEBUG environment variable set to "true".
>>>> 
>>>> - Alexey
>>>> 
>>>> On 4/30/2019 11:15 AM, Tom Anderson wrote:
>>>>> Hello,
>>>>> 
>>>>> I am trying out the early-access jpackage tool. It works perfectly on 
>>>>> Linux, but on Windows produces a binary which does not do anything when 
>>>>> run.
>>>>> 
>>>>> I would like to either fix any error i have made, or help you identify a 
>>>>> bug, if there is one!
>>>>> 
>>>>> Is this the right place to come with this problem? If not, where should 
>>>>> i go? Is there a list of known issues other than on the download page 
>>>>> [1]? What debugging steps should i try? Would a self-contained example 
>>>>> be helpful to you? What other information would you like?
>>>>> 
>>>>> Regards,
>>>>> tom
>>>>> 
>>>>> [1] https://jdk.java.net/jpackage/


More information about the core-libs-dev mailing list