How to compile java code?

3rd Jul 2017, 3:52 PM
vaibhav patil
vaibhav patil - avatar
2 Answers
+ 2
os? if ur on linux um make sure u wrap ur main() method in a class lets say the name of the class is Doge. do these javac filename.java # that is to compile java Doge # this is to execute whatever is inside class Doge {} done u gon see the output and stuff if ur on windows idk
3rd Jul 2017, 3:55 PM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 1
hi, in addition to the above answer, u have to install jdk and set the environmental variable so that java can be used any where when u use cmd and check java - version to check java installed correctly
3rd Jul 2017, 5:44 PM
Nanda Balakrishnan