Fallowing icon

Tuesday, September 18, 2012

Run Java Code using Command Prompt


We can run the Java code using the Command Prompt, NetBeans, Etclips and etc. However the basic way to run the Java code is using the Command Prompt.

* First We want to know where Java is successfully installed.

If the check is successfully installed, type  javac on your Command Prompt and press Enter.

If the Java has successfully been Installed, You can see the Command Prompt  like this.





If the Java has not successfully Installed, You can see the Command Prompt  like this.


 If the Java has not successfully been Installed, Click hear and resolve your problems


* If the Java is successfully working, Now go to the location of where your Java file exist through Command Prompt.

Ex:- I save my Java file (myfirst.java) on the Desktop. Therefore I type cd Desktop and press enter.
Now Command Prompt in Desktop location.



* After compiling your Java file, type javac FILENAME WITH .java  and press Enter.
Ex:- javac myfirst.java



* Finally to run your Java file type Java FILENAME and press Enter.
Ex:- java myfirst

Now you can see the output Hello World.


No comments:

:a   :b   :c   :d   :e   :f   :g   :h   :i   :j   :k   :l   :m   :n   :o   :p   :q   :r   :s   :t

Post a Comment