You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Question about creating AppImage for CLI Java applications #345
I want to build an AppImage of Drifty CLI, a CLI version of Drifty which requires terminal as an interface between the application and the user. But, the AppImage created by JavaPackager plugin for the CLI, does not open the Application in terminal mode. What property should I set in the pom.xml such that my objectives fulfill?
What is the expected behavior?
A CLI Application to be created, which when run by the user, starts the Java app with terminal as the only interface.
What is the motivation / use case for changing the behavior?
This feature if not already present, will help in distributing terminal based Java applications.
Let's see if I understand correctly, when running Drifty CLI from menu, does it have to open a terminal window and run your app on it?
Right now, you just have to open a terminal and run your AppImage binary, passing any necessary arguments.
Yeah @fvarrui , you understood correctly. When the user double-click and run the Drifty CLI AppImage, the terminal does not pop up.
And my question is that is there any way to tell the AppImage builder to enable Terminal and run the app in it?
Like in the below image, an example of a velocity template file contains a line Terminal=false. So, can this .vtl files help to fulfill my objective (to open the app in terminal)?
Here is the link to the above file - https://github.com/fvarrui/JavaPackager/blob/master/src/main/resources/linux/desktop.vtl .
JP uses a BASH script as executable (JAR file is concatenated to this script as a payload), and maybe we can change the startup.sh.vtl template to accept --terminal argument to run itself again with x-terminal-emulator, so this change will be available not only for AppImage, but for DEB, RPM, zipball, tarball too. I then we can run our app on a terminal from desktop file using ${info.name} --terminal %U.
I'm not really sure if this could have side effects and if it's really a good idea. What do you think?
JP uses a BASH script as executable (JAR file is concatenated to this script as a payload), and maybe we can change the startup.sh.vtl template to accept --terminal argument to run itself again with x-terminal-emulator, so this change will be available not only for AppImage, but for DEB, RPM, zipball, tarball too. I then we can run our app on a terminal from desktop file using ${info.name} --terminal %U.
I'm not really sure if this could have side effects and if it's really a good idea. What do you think?
PRs are welcome 😅
Yeah, it's pretty good Idea. Let me have a look in the project and understand it. @fvarrui . If possible, I might open a PR for this.
JP uses a BASH script as executable (JAR file is concatenated to this script as a payload), and maybe we can change the startup.sh.vtl template to accept --terminal argument to run itself again with x-terminal-emulator, so this change will be available not only for AppImage, but for DEB, RPM, zipball, tarball too. I then we can run our app on a terminal from desktop file using ${info.name} --terminal %U.
I'm not really sure if this could have side effects and if it's really a good idea. What do you think?
PRs are welcome sweat_smile
Hey @fvarrui, I have checked your GitHub discussions #292 and have found that jpackage has options to generate installers for CLI apps (like --win-console option for windows OS CLI apps).
So, I think adding support for jpackage might help for this issue even.
Activity
SaptarshiSarkar12 commentedon Jul 5, 2023
@fvarrui Another issue to look into. I think this feature is not already present.
fvarrui commentedon Jul 6, 2023
Hi @SaptarshiSarkar12!
Let's see if I understand correctly, when running Drifty CLI from menu, does it have to open a terminal window and run your app on it?
Right now, you just have to open a terminal and run your AppImage binary, passing any necessary arguments.
SaptarshiSarkar12 commentedon Jul 6, 2023
Yeah @fvarrui , you understood correctly. When the user double-click and run the Drifty CLI AppImage, the terminal does not pop up.

And my question is that is there any way to tell the AppImage builder to enable Terminal and run the app in it?
Like in the below image, an example of a velocity template file contains a line
Terminal=false. So, can this .vtl files help to fulfill my objective (to open the app in terminal)?Here is the link to the above file - https://github.com/fvarrui/JavaPackager/blob/master/src/main/resources/linux/desktop.vtl .
fvarrui commentedon Jul 8, 2023
The right .desktop files template for AppImages is https://github.com/fvarrui/JavaPackager/blob/master/src/main/resources/linux/desktop-appimage.vtl.
I'm trying something like this:
This will run your CLI app inside your default terminal emulator ... or at least, I think so. I keep testing!
SaptarshiSarkar12 commentedon Jul 8, 2023
ok, let me try in my local environment. Thank you @fvarrui !
SaptarshiSarkar12 commentedon Jul 13, 2023
@fvarrui The command
x-terminal-emulator -e "${info.name} %U"doesn't work i.e. the AppImage does not open itself in terminal mode.fvarrui commentedon Jul 17, 2023
@SaptarshiSarkar12 I'm still doing tests, but I think it's the way to go
fvarrui commentedon Jul 17, 2023
JP uses a BASH script as executable (JAR file is concatenated to this script as a payload), and maybe we can change the
startup.sh.vtltemplate to accept--terminalargument to run itself again withx-terminal-emulator, so this change will be available not only for AppImage, but for DEB, RPM, zipball, tarball too. I then we can run our app on a terminal from desktop file using${info.name} --terminal %U.I'm not really sure if this could have side effects and if it's really a good idea. What do you think?
SaptarshiSarkar12 commentedon Jul 17, 2023
Yeah, it's pretty good Idea. Let me have a look in the project and understand it. @fvarrui . If possible, I might open a PR for this.
SaptarshiSarkar12 commentedon Jul 17, 2023
Hey @fvarrui, I have checked your GitHub discussions #292 and have found that jpackage has options to generate installers for CLI apps (like --win-console option for windows OS CLI apps).
So, I think adding support for jpackage might help for this issue even.
SaptarshiSarkar12 commentedon Jul 17, 2023
I have added some links and facts in #292 , check them out. They might be of help.