do you have a java command line program? then this library is for you. Simply call OpenTerminal#INSTANCE#run(Foo.class, args). Then it opens a native command prompt terminal via double click based on your current os to execute your jar file. It opens just like it's from a batch / shell script file. for jars that do not handle 0 arguments create use TerminalAppWrapper as the parameter
Screenshots(double click jar):
Features:
user.appdatais now a System propertyuser.dir,user.home,java.io.tmpdir,user.appdatacan all be changed before callingOpenTerminal#runJREUtil#syncUserDirWithJarwill sync the user dir with jar's parent directory #call beforeOpenTerminal#runTerminalApp#shouldPause#this option will not pause withSystem#exitTerminalApp#hardPause#this option will pause withSystem#exitTerminalAppWrapper#this option will get user input args before executing your program, custom wrappers can return custom arugments with or without getting user input- users should parse their config options for the TerminalApp during
OpenTerminal#isLaunchingreturns true - users should parse their program config after
OpenTerminal#runhas been called or checking ifOpenTerminal#canExe
Executing the jar from an external Process:
-Dopenterminal.<TerminalApp#var>=value#override a TerminalApp property from the executable jar! excludes special properties like openterminal.appClass and openterminal.programArgs-Dopenterminal.background=boolean#will force the jar to run in the background if it's set to true-Dopenterminal.terminal=value#controls the terminal string-Dopenterminal.forceTerminal=boolean#if true forces it to always open a new terminal window if the process is a compiled jar-Dopenterminal.shouldPause=boolean#forces shouldPause true/false-Dopenterminal.hardPause=boolean#forces hardPause true/false-Dopenterminal.jvmArgs=jvmArgs#execute the jar with those jvm arguments. Allows the launcher to run with default arguments while the actual executing process has them
Note: SelfCommandPrompt is now getting replaced with OpenTerminal to fix unfixable issues with the SelfCommandPrompt's current design. It's still avalible for download in the release page
Features:
- SelfCommandPrompt#runWithCMD opens a native command line terminal based on your os once the user double clicks the jar
- SelfCommandPrompt#wrapWithCMD opens a native command line terminal, gets user args(if any) before executing a strictly command line jar that doesn't handle 0 args with a scanner.
Disadvanteges:
- on jar double click the args are always 0. In the future it is planned to edit the terminal's text field so users can save their last command and input it in on startup. This library is free of charge and open source. On top of that you are also allowed to embedd this into your application programs but, I ask that you update when bugs are fixed