Run Java file with Window cmd Create a source code file (.java) Save & Remind the saved directory Open ‘cmd ‘ and change directory to where java file is located Check java jdk is installed in your computer. ($ java –version) Compile and run java file (javac HelloWorld.java java HelloWorld)
Run Java file with Linux terminal Create a source code file (using vi editor) ($ vi HelloWorld.java)
Run Java file with Linux terminal <How to use vi editor>
In Command mode (escape) i : insert mode (can insert letter) x : erase one letter :wq! : save file and exit editor
Ex) Press ‘Esc’ key Press ‘i’ to insert letters Press ‘Esc’ key Press ‘x’ to erase a letter Press ‘Esc’ key Press ‘h, j, k, l’ to move cursor Press ‘Esc’ key Press ‘:wq!’ to save and exit editor
Run Java file with Linux terminal 2. Write a source code file (using vi editor) 3. Check .java file
Run Java file with Linux terminal 4. Check Java version 5. Compile and Run ‘HelloWorld.java’
<Window cmd command> cd: change directory dir: Display a list of files and folders <Linux terminal command> ls: Display a list of files and folders