创建一个批处理文件,对于简单的javac和java命令执行 [英] Creating a batch file, for simple javac and java command execution
问题描述
这是一个非常简单的事情,但我不能让我的头周围。我看过很多的StackOverflow职位和以及在互联网上。
我的目标是创建一个.BAT将打开cmd并执行我的Main.java到命令提示符。容易是吧,但我有困惑,怎么样?
下面我写这我的批处理文件应执行步骤
- 开启CMD
- 的javac Main.java
- Java的主要
所以我假设我不需要给予明确的路径我的文件将驻留旁边,我所有的.java
我的理解迄今为止的研究:
- 开启文本编辑器
- 写一个code打开CMD(这我不知道如何)
- 回声的javac Main.java(仍是模糊的概念对我来说)
- 回声的Java主
另存为:name.bat
任何帮助将AP preciated。谢谢你。
-
打开记事本
-
写
关闭@echojavac的Main.javaJava的主要
3.saveAs blahblah.bat
确保Main.java居住与您的批处理文件和java路径ENV中设定。变量
4。在批处理文件双击,无需打开CMD明确TT将打开本身的.bat执行
It is a really simple thing but I cannot get my head around it. I have looked at plenty of StackOverFlow post and as well as on internet.
My goal is to create a .bat which will open cmd and execute my Main.java into command prompt. Easy isn't it, but I have got confused about how?
Below I am writing steps which my batch file should perform
- open cmd
- javac Main.java
- java Main
My file will reside next to all my .java so I am assuming I don't need to give explicit path.
My understanding so far by research:
- open text editor
- write a code to open cmd(Which I am not sure how)
- echo javac Main.java (Which is still fuzzy concept for me)
- echo java Main
Save as: name.bat
Any help will be appreciated. Thank you.
open notepad
write
@echo off javac Main.java java Main
3.saveAs blahblah.bat
make sure that Main.java resides with your batch file and java path is set in env. variable
4 . double click on batch file, no need to open cmd explicitly tt will open itself on .bat execution
这篇关于创建一个批处理文件,对于简单的javac和java命令执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!