Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to build a launcher both for CLI and GUI apps? #150

Open
valnaumov opened this issue Feb 2, 2024 · 1 comment
Open

How to build a launcher both for CLI and GUI apps? #150

valnaumov opened this issue Feb 2, 2024 · 1 comment

Comments

@valnaumov
Copy link

valnaumov commented Feb 2, 2024

I have a class with a main method serving as an entry point for the application, both for graphical and command-line interfaces. If any command-line arguments are passed to the app, it starts in headless mode. If no arguments are specified, it starts with a GUI. When it starts with a GUI, I don't want the console window to be shown.

As far as I understand, I can create two launchers: one for GUI, one for CLI. Which is not very straightforward with this plugin though. But can I do it within the same launcher?

I had a clue that this could be done using a custom launcher script and choosing java or javaw based on whether the app was passed any command-line args or not. I assumed that this launcher scripts are somehow compiled into an executable launcher. Is this assumption correct?

def resourceName = noConsole ? '/windowsScriptTemplateJavaw.txt' : '/windowsScriptTemplate.txt'

I tried to check my assumption by providing a custom launcher script. See my demo. I inserted an echo command and also set environment variable DEBUG=TRUE to enable output on the script. Judging that it does not output any echo commands and does not behave the way I want it to (choose java/javaw), I conclude that it is not using this script for the launcher. It is not used for :run task either.

What is the purpose of unixScriptTemplate and windowsScriptTemplate launcher properties? The docs give a very vague description. Am I using it wrong in my demo? Why is not used?

@yuricrona
Copy link

yuricrona commented May 2, 2024

Same, I also tried to put mkdir some absolute path, and tried to debug with windows process monitor, got nothing.

I noticed also since it depends on runtime task, it generates script and bootScripts also generated during Jpackage. Tried to modified both using gradle task but no luck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants