如何在Java中的单个命令中编译和运行 [英] How to compile and run in single command in java

查看:65
本文介绍了如何在Java中的单个命令中编译和运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在单个命令行中编译并运行。
通常,我们先编译然后运行?

I want to compile and run in the single command line. Usually, we first compile and after the run?

javac example.java

java example

我可以运行吗,

javac example.java && java example


推荐答案

您可以使用函数:

Myfunction() { javac $1.java && java $1 ; }

用法:

Myfunction example

此问题重复,请在发布$ b之前进行搜索$ b请参见:使用单个命令行Java进行编译和构建(Linux )

This question is duplicated , please to search before posting See : Compile and build with single command line Java (Linux)

致谢

这篇关于如何在Java中的单个命令中编译和运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆