How do I make my java application open a console/terminal window?

前端 未结 13 1295
日久生厌
日久生厌 2020-12-28 21:12

Is there any way I can make an executable .jar that will open up the command line when double clicked?

I\'m making a text-based adventure game. As of right now it is

相关标签:
13条回答
  • 2020-12-28 22:03

    I wrote a little snippet which uses a similar approach to Brandon Barajas' solution. It supports Mac (untested), Linux (tested with xfce) and Windows (cmd) in one go (although you might need to customize the linux terminal commands, since there are many different ones).

    https://github.com/Lartsch/java-selfconsole/

    Really helpful in the following case:

    • you don't want the jar to have to be directly executed in a console
    • you can't use any custom made console / can't use any GUI library
    • you don't want to ship bridge starting files like sh, bat, ...
    • you simply want the jar to open itself in a console on double-click
    0 讨论(0)
提交回复
热议问题