Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以使用“./hello”之类的命令在 Linux 命令行中调用 Java 程序?
只需创建一个名为 的脚本hello,将其 chmod 为可执行文件,将其放在 PATH 环境变量中注册的文件夹中,例如:
hello
$ echo '$JAVA_HOME/bin/java -jar /path/to/myjar.jar' > hello $ chmod a+x hello $ ./hello