Creating a batch file, for simple javac and java command execution

前端 未结 11 2894
终归单人心
终归单人心 2021-02-15 14:18

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 whi

11条回答
  •  萌比男神i
    2021-02-15 14:41

    Create a plain text file (using notepad) and type the exact line you would use to run your Java file with the command prompt. Then change the extension to .bat and you're done.

    Double clicking on this file would run your java program.

    I reccommend one file for javac, one for java so you can troubleshoot if anything is wrong.

    • Make sure java is in your path, too.. IE typing java in a Dos windows when in your java workspace should bring up the java version message. If java is not in your path the batch file won't work unless you use absolut path to the java binary.

提交回复
热议问题