How to Run Java Programs With Command Prompt (cmd) and Notepad in Windows
ฝัง
- เผยแพร่เมื่อ 14 พ.ย. 2021
- How do you compile and execute your Java programs from the command prompt (cmd) in Windows? Also, how you can you write your programs just using Notepad?
We'll go over how to write a Java program in Notepad, then how you can compile and run that program directly from the command prompt (cmd) in Windows.
The video shows Windows 11, but the same process works for Windows 10 or other version of Windows.
This is a great beginner's Java video if you're learning how to execute your programs, or if you're used to using an IDE like Eclipse, and want to learn how to use the command prompt (cmd) instead.
Learn or improve your Java by watching it being coded live!
Hi, I'm John! I'm a Lead Java Software Engineer and I've been in the programming industry for more than a decade. I love sharing what I've learned over the years in a way that's understandable for all levels of Java learners.
Let me know what else you'd like to see!
JDK download: www.oracle.com/java/technolog...
Links to any stuff in this description are affiliate links, so if you buy a product through those links I may earn a small commission.
📕 THE best book to learn Java, Effective Java by Joshua Bloch
amzn.to/36AfdUu
📕 One of my favorite programming books, Clean Code by Robert Martin
amzn.to/3GTPVhf
🎧 Or get the audio version of Clean Code for FREE here with an Audible free trial
www.audibletrial.com/johnclean...
🖥️Standing desk brand I use for recording (get a code for $30 off through this link!)
bit.ly/3QPNGko
📹Phone I use for recording:
amzn.to/3HepYJu
🎙️Microphone I use (classy, I know):
amzn.to/3AYGdbz
Donate with PayPal (Thank you so much!)
www.paypal.com/donate/?hosted...
☕Complete Java course:
codingwithjohn.thinkific.com/...
codingwithjohn.com
John, you're simply the best. All the tutorials from my university never seemed to work for me until I watched your video following all your detailed steps. Thanks for making me run my first java program and making it feel so simple.
Thank you John, you're the best. I had an assignment to run a program in command prompt and I continuously got errors. Finally, I understood it.
Great video! It worked! My programming professor told me to try using cmd to run our java project, and I kept on getting errors until I watched your video. Thanks a lot!
And in addition, I searched for the same question few weeks ago here on TH-cam and no one was able to help me like you did. Definitely worth subscribing! 😁
Yes absolutely this vedio helped me a lot...
Thank you👍
So simple and to the point without any unnecessary hassles! Thank you!
Thank you so much John, I've been searching how to do for so long.
Thank you for such a simple and straightforward explanation.
I learnt a lot from your videos in past 24 hrs.
Thank you sir for sharing such videos.
I am so thankful for this. This saved my life. As a beginner, I was losing my mind
Hi John, thank you very much for your videos.
You have the best Java learning channel that I have come across. I've been using your channel to review my Java knowledge after not coding in java for 3+ years and preparing for a Fang interview. I'm also planning to do a talk on it and referencing anybody who wants to learn Java to you.
My request is: "Will you please do a video on Lambdas?"
You just taught me something I needed for class. Thank you so much.
Great video. I just started a Java course on Moodle and your explanation here helped a lot. Will be following you in future. Many thanks.
Thanks big dog, I appreciate content creators such as yourself. You dove straight into the point with great information. Much love ❤
Thank u so much 🙏🙏 I watched so many videos but didn't get it to run Java in CMD...ur video helped me a lot...❤
The best explanation I've ever watched !
Thank you very much sir, amazing video ,helped me a biology student who once had no knowledge on computer science,c, java and now I am praised by my java teacher during lab sessions. Once again
Thank you a lot
So simple, but very needed, thx
i try many other videos without result this video is very helpfull for beginners like me, thank you
thank you ! I was struggling for this it really helped me
Thank you Sir. I am already practicing it after a short while 😊
Thank you so much. I felt so frustrated for doing this Java file process. You really helped me sir.
You are a star, amazing explanation and you make amazing videos!
thank youuu so muchhhh this help me to do my assignment, at first i'm very confuse but i found this video and finally it work yayyy✨
Amazing!! Thank you for your material, it helps big time.
Thank you! This was very helpful👍
Thank you, big fan out here!!
Amazing video John.. thank you !!!
thanks for explaining in detail
Thanks sir for providing the wonderful commands previously i had to run task build java then click on run button it was too time consuming but its so simple.....
I attend my college lectures of java but didn't understand anything but by watching your single video I got know the basics of java thank you sir ❤
Thank you so muchh brother, It worked after watching a lot of videos...
John, you are the best and thank you so much it really worked
Thank you so much my school couldn't teach me that in a month you just did it in a minute
So relatable 😂❤
Thanks.This really helped me out
Thank you sooo much for helping out
You just saved my life thank you
Thanks. Extremly good explained
thanks! that was really helpful!
Thanks it's working!!
Thankyou sir this was very helpfull
thank you sir , It helped alot
Bro, you are awesome.
Thank you so much!!!! Headache gone 😅
Ohhh myy godd. It finally worked. Thankyou!!
Thank you john
Loved it !
Simply explanation
Amazing tutorial
thankyou for this video.
Thankyou thankyou thankyou thankyou thankyou thankyou so very much🙂 This has really been very helpful:)
Thanku so much sir . Your video is really helpful for me you can simply teach us how I can use cmd. Once again thanku so much ❤❤❤❤❤
Thanks a lot 🎉
Nice one. Great job sir
Thank you sir❤
Nice tutorial although I have an src folder with multiple packages and I need the classes from each package to be compiled into the target folder and need to run the driver class from the target folder. Is there a video on this? Thanks
I would've added command line arguments to the tutorial as this is the best way to demo them!
Very Nice teach 👍🏻
Thanks my friend
Very informative thnk u
THANK YOU SO MUCH!!!!!
nice work man
Great video 👏
Could not find or load main class helloworld
Caused by: java.lang.ClassNotFoundException: helloworld
mine is showing this error please what can i do
Thanks help out heaps I sort forgot how change folder in cmd
Thank you Sir.
Maaan!!.. you are the best
Thanks very much 🥰
Thank you so much 🤍
thank you so much
Informative
Thanks!
well, dang!
thanks you very much!
Awesome channel, could you do a video about stack and heap memory?
Best Java tutorial, i was stoped cause i always use javac and dont get any output :( im trying to study java alone haha im from python code, same way, at cmd, and there is a special way to do it, here at the same but diferent way you need to compile and then run it, thanks you for this tutorial, now let the java training start !!
John the besttt
Thanks mahn!
Thank you
Thnq sooooooo much sirrr
thank you sir
شكرا 💙
Thank you :)
amazing explanation thank you .
thanks man
John can you please do some search algorithms and more sorting videos, thank you
I'm here because my OOP exam requires us to do our hands-on exam on notepad. Lezz goooo
thank you so much....
lol! First thing our old-school Java Profs at Uni taught us, they insisted we only use notepad++ and compile & run our code just like this in cmd, no IDE's allowed. Looking back now I must say this is a great way to learn by forcing you to remember and know how to do thing IDE's usually do fòr us these days.
Can you show us if there's a way to view the bytecode and machine code of our Java Program as well? Thanks!
Hi, John. Thank you for this tutorial, really helped me a lot. Question though, what if I have multiple classes?? How do I compile and run it in the cmd? Or is it even possible?
I have the same question...
I am new to learn coding recently start learn to do coding in java there vast syllabus there is no time to cover all the topics right now to me i want to do coding in java please share some tricks and tips and shortcut to able to do java coding and do tasks u r ans and support is very much need I am impressed by u r knowledge I hope u solve my problem dear❤
yhank you my guy
Thanks for you effort,
Does the class name and the java file name have to be the same?
hey i have done the things u said but in cmd i have a issue that i have given cd desktop and enter then it us giving that C:\Users\endg3>cd Desktop
The system cannot find the path specified. how to solve this.
Hello, i have an issue, i have multiple classes in a project, they also use imports. This method does not support that and i can't seem to find any documentation on compiling a full java project in the command line. Do you have any clue on this?
amazing. i feel like i can create any app soon.😅
I am getting this error: Could not find or load main class Demo
Caused by: java.lang.ClassNotFoundException: Demo
After the { how do you click enter that starts on the 2nd line and not in the first line below?
so. clear. :DDDD thanks
When I interd "cd Desktop" it says
"The system cannot find the path specified"
Any clue why?
Edit: Problem solved, I just did a right click one the .java file and choose open in terminal.
Hey John, on my side I can't find my file when I enter cd documents and dir.
What should I do?
How to set code file open with notepad like that ?....in my pc showing only ...(open with VS code)