I'm creating a CLI program in Kotlin (Java). I want to bind the main function/class to an individual command, such as program.
However, from what I searched online, it seems like the only way to run a Java program is with the command java. For example, java -jar program.jar args, or java -cp "..." Program args. But they are very inconvenient for users to type every time, which I experienced when I used BFG, a command-line repository cleaner tool written in Java.
I could use an alias, but there is no standard way to add aliases to a system when users install my CLI program. For example, most people use Bash, so I have to install the alias to .bashrc or .profile, but others might use zsh or csh, which don't read .profile.
I could also wrap it with a native program, but I'll need to write that in a native language just to redirect the commands, which I might as well just rewrite the entire thing in that language.
In Node.js, developers can simply specify their command in their package.json and everyone who installed this package through npm i -g can use the command. What is the simplest alternative to this in JVM languages?
javacall inside, and pass arguments if there are any. Then, make sure to put your script onPATH. It should do.program.sh? That's fine, and in my installer, should I put the script along with my.jarin a universal/binfolder like/usr/local/bin? or should I leave them where they are and modify$PATH?