Tuesday, June 6, 2017

Run Java using CMD



Download Latest Java
Config Java path in Computer Properties>Environment Variables
  • Select Start -> Computer -> System Properties -> Advanced system settings -> Environment Variables -> System variables -> PATH.
  • Prepend C:\Program Files\Java\jdk1.6.0_27\bin; to the beginning of the PATH variable.
  • Click OK three times.
  • check java version
  • C:\Users\username>java -version
  • C:\Users\username>javac -version
Customize CMD
  • Set Layout -> Screen Buffer Size to 80 x 500.
  • Select Options -> Edit Options -> QuickEdit Mode.
  • Select Options -> Edit Options -> Insert Mode.
Compile and Execute
  • C:\Users\username>cd c:\introcs\hello
  • C:\introcs\hello\>
  • C:\introcs\hello\>javac HelloWorld.java
  • C:\introcs\hello\>
  • C:\introcs\hello\>java HelloWorld



No comments:

Post a Comment