镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Question about creating AppImage for CLI Java applications #345

Open

Description

@SaptarshiSarkar12

I'm submitting a…

  • bug report
  • feature request
  • other

Short description of the issue/suggestion:

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.

Please tell us about your environment:

  • JavaPackager version: 1.7.2
  • OS version: Ubuntu-22.10
  • JDK version: 20.0.1
  • Build tool:
    • Maven
    • Gradle

Activity

  1. SaptarshiSarkar12 commented on Jul 5, 2023

    @SaptarshiSarkar12
    ContributorAuthor

    @fvarrui Another issue to look into. I think this feature is not already present.

  2. fvarrui commented on Jul 6, 2023

    @fvarrui
    Collaborator

    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.

  3. SaptarshiSarkar12 commented on Jul 6, 2023

    @SaptarshiSarkar12
    ContributorAuthor

    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.

    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)?
    image
    Here is the link to the above file - https://github.com/fvarrui/JavaPackager/blob/master/src/main/resources/linux/desktop.vtl .

  4. fvarrui commented on Jul 8, 2023

    @fvarrui
    Collaborator

    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:

    Exec=x-terminal-emulator -e "${info.name} %U"
    Terminal=true

    This will run your CLI app inside your default terminal emulator ... or at least, I think so. I keep testing!

    PS: you can create and use your own custom templates (link)

  5. SaptarshiSarkar12 commented on Jul 8, 2023

    @SaptarshiSarkar12
    ContributorAuthor

    ok, let me try in my local environment. Thank you @fvarrui !

  6. SaptarshiSarkar12 commented on Jul 13, 2023

    @SaptarshiSarkar12
    ContributorAuthor

    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:

    Exec=x-terminal-emulator -e "${info.name} %U"
    Terminal=true

    This will run your CLI app inside your default terminal emulator ... or at least, I think so. I keep testing!

    PS: you can create and use your own custom templates (link)

    @fvarrui The command x-terminal-emulator -e "${info.name} %U" doesn't work i.e. the AppImage does not open itself in terminal mode.

  7. fvarrui commented on Jul 17, 2023

    @fvarrui
    Collaborator

    @SaptarshiSarkar12 I'm still doing tests, but I think it's the way to go

  8. fvarrui commented on Jul 17, 2023

    @fvarrui
    Collaborator

    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 😅

  9. SaptarshiSarkar12 commented on Jul 17, 2023

    @SaptarshiSarkar12
    ContributorAuthor

    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.

  10. SaptarshiSarkar12 commented on Jul 17, 2023

    @SaptarshiSarkar12
    ContributorAuthor

    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.

  11. SaptarshiSarkar12 commented on Jul 17, 2023

    @SaptarshiSarkar12
    ContributorAuthor

    I have added some links and facts in #292 , check them out. They might be of help.

  12. added
    enhancementNew feature or request
    and removed
    working onWork in progress on this issue
    on Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions