简体   繁体   中英

What is the easier way to debug jpackage?

I have a problem with jpackage that is rare enough for not to share here. I feel my only way to kill this bug is to debug the jpackage tool's code. I've seen that its code is pure Java and I was wondering if there is an easy way to see the failing code running step by step

I'm an experienced java programmer and I know how to use a debugger but I could not start jpackage from Java (it seems the main class package is not exported from its module). I think that compile the full JDK will be too much for me (because it is native code) and that is probably not the way to reach the Java part of the code

That's why I ask you for help here. ¿is there another way?

I'm simply not able to do it alone and the situation is very frutrating because I've been coding a solution for weeks and now I don't have anything to deliver because of this bug. I have also no time to file the bug (It's difficult to know if it is a JDK or a Wix bug and I need to finish my work in a week)

In an ideal world it should be possible to run jpackage.exe in debug mode and attach a remote debugger to it but it sounds like reality is a little bit harder

Thank you in advance

What you can do is invoke jpackage through the ToolProvider API:

static final ToolProvider JPACKAGE = ToolProvider.findFirst("jpackage").orElseThrow();
public static void main(String[] args) {
    JPACKAGE.run(System.out, System.err, "--help"); // put actual options here
}

You can then debug this application from an IDE or other debugger, and step into the jpackage code from there.

This works since in this case jpackage runs in the same process as the program it's called from.


If a wix command fails with a certain exit code, you can also re-run jpackage with the --temp option to output all the temp files into a fixed directory, and then re-run the failing Wix command from the exception message directly.


Yet another option that can help is the --verbose option, which makes jpackage output more information.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM