Let's try to get the output as "Hello World" from Java and run on CMD
- should be installed JDK and should be made the path on your computer
- clear folder
- notepad
First of all, We have to create a new folder in Desktop. So, I created a new folder and rename it "java". You can give any name that you need. But it is better to give a simple and short name for the folder because we are going to run the java program in CMD.
Then after that, you need to go inside your newly created folder. In my case, I will go to the java folder. Then in the white space, press the right-click button on your mouse. Go to "New" and choose "Text Document". This process will create a text file and it will be opened with the notepad app.
Once you have done like above, you will be having text file like below.
- It should be clean (doing this, will help you to understand clearly of java programming).
- Be careful with lowercase and uppercase (Otherwise, you will be having some errors).
- Do not miss any symbols like below.
Step 1:
Step 2:
Step 4:
Step 5:
9. After opening CMD, you have to type "javac" command. Then after that, press space key one time and type your newly created file name with extension. Then press the "Enter" key in your keyboard. If there are not any error, you will see the cmd window like this below. If you came to next command line without getting any error, it means you have written correctly your java codes in text file.
Little explanation of the process according to my activity
Step 6:
10. Let's run our little java program. To do that, you have to type the "java" command and press the space key and type only name of the byte code. In my case, I type "java MyFirst" as below.
These simple 6 steps will guide you in a very easy mode with evidence of the process. So, you could simply understand from start to end by studying this post. This is a very simple project that we have shared with you.
You can leave any feedback in the comment
if you got any problem let us know in the comments or by email and we will help you as soon as possible.
Thanks for staying with us!
0 Comments