How to use CMD to run java codes | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to use CMD to run java codes

I always use IDEs like Netbeans or Eclipse for execution of my java code suggest a stepwise procedure to run the java code using CMD

12th Oct 2017, 1:46 PM
Nilesh Tanwar
Nilesh Tanwar - avatar
5 Answers
+ 4
Make a notepad file with code. Then save it to some random place woth name classname.java Open CMD, and redirect it to the folder in which you saved your class. $javac classname.java This would compile your class $javac classname This would run your program
12th Oct 2017, 1:49 PM
Meharban Singh
Meharban Singh - avatar
+ 4
you forgot $ sign
12th Oct 2017, 1:53 PM
Meharban Singh
Meharban Singh - avatar
+ 2
thanks @luka
12th Oct 2017, 1:58 PM
Nilesh Tanwar
Nilesh Tanwar - avatar
+ 1
On Eclipse(never used netbeans, but suppose it is similar) you can export your code as a executable java program, then double click it. This way you creates your program.exe ,😎
18th Oct 2017, 5:23 PM
LF Campos
LF Campos - avatar
0
it is showing javac as unrecognised command !! if I follow above answer
12th Oct 2017, 1:51 PM
Nilesh Tanwar
Nilesh Tanwar - avatar