How to Run Java Programs With Command Prompt (cmd) and Notepad in Windows

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

Пікірлер: 216

  • @Ecstasy_Android_Gamer
    @Ecstasy_Android_Gamer2 жыл бұрын

    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.

  • @dikshyakafle5530
    @dikshyakafle5530 Жыл бұрын

    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.

  • @nird4897
    @nird48972 жыл бұрын

    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!

  • @nird4897

    @nird4897

    2 жыл бұрын

    And in addition, I searched for the same question few weeks ago here on KZread and no one was able to help me like you did. Definitely worth subscribing! 😁

  • @ironman......

    @ironman......

    11 ай бұрын

    Yes absolutely this vedio helped me a lot... Thank you👍

  • @soul_conscious
    @soul_conscious Жыл бұрын

    So simple and to the point without any unnecessary hassles! Thank you!

  • @clairejing1958
    @clairejing1958 Жыл бұрын

    Thank you so much John, I've been searching how to do for so long.

  • @aramesmaeili4099
    @aramesmaeili4099 Жыл бұрын

    I am so thankful for this. This saved my life. As a beginner, I was losing my mind

  • @franz2027
    @franz20272 жыл бұрын

    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?"

  • @sforsuraj7255
    @sforsuraj7255 Жыл бұрын

    I learnt a lot from your videos in past 24 hrs. Thank you sir for sharing such videos.

  • @JJJJ-gl2uf
    @JJJJ-gl2uf Жыл бұрын

    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.

  • @battleforge6177
    @battleforge617710 ай бұрын

    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

  • @Julia-nk2gj
    @Julia-nk2gj Жыл бұрын

    Thank you for such a simple and straightforward explanation.

  • @lisatorres2234
    @lisatorres2234 Жыл бұрын

    You just taught me something I needed for class. Thank you so much.

  • @Swathi12383
    @Swathi123832 ай бұрын

    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...❤

  • @nehalkalambe9896
    @nehalkalambe9896 Жыл бұрын

    thank you ! I was struggling for this it really helped me

  • @srisaikunderu1429
    @srisaikunderu1429 Жыл бұрын

    Thank you so much. I felt so frustrated for doing this Java file process. You really helped me sir.

  • @Garrison86
    @Garrison862 жыл бұрын

    Amazing!! Thank you for your material, it helps big time.

  • @Hakim_fadhli
    @Hakim_fadhli Жыл бұрын

    i try many other videos without result this video is very helpfull for beginners like me, thank you

  • @jesusdiaz5008
    @jesusdiaz5008 Жыл бұрын

    Thanks big dog, I appreciate content creators such as yourself. You dove straight into the point with great information. Much love ❤

  • @arnavchauhan9637
    @arnavchauhan96377 ай бұрын

    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.....

  • @sphurtikulkarni9781
    @sphurtikulkarni9781Ай бұрын

    Thank you so much for such a detailed video and great explanation!

  • @Beeetle_Juice
    @Beeetle_Juice9 ай бұрын

    The best explanation I've ever watched !

  • @prokopii18
    @prokopii182 жыл бұрын

    You are a star, amazing explanation and you make amazing videos!

  • @Jan_Jan_
    @Jan_Jan_2 жыл бұрын

    Thank you! This was very helpful👍

  • @niksatan
    @niksatan Жыл бұрын

    So simple, but very needed, thx

  • @pedroaboffa
    @pedroaboffa2 жыл бұрын

    Amazing video John.. thank you !!!

  • @Fits124
    @Fits124Ай бұрын

    What an amazing video, thank you so much John

  • @Livebio1786
    @Livebio17863 ай бұрын

    Thank you sooo much for helping out

  • @Swagboij
    @SwagboijАй бұрын

    Amazing clear and concise tutorial man thank you

  • @swapnilbawiskar3617
    @swapnilbawiskar3617 Жыл бұрын

    Thank you so muchh brother, It worked after watching a lot of videos...

  • @SagarSharma-pb6xh
    @SagarSharma-pb6xh3 ай бұрын

    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 ❤

  • @Atojushorts
    @Atojushorts Жыл бұрын

    Thanks.This really helped me out

  • @mulexawikjo8207
    @mulexawikjo820710 ай бұрын

    thanks for explaining in detail

  • @user-lk2cy7cc5v
    @user-lk2cy7cc5v Жыл бұрын

    John, you are the best and thank you so much it really worked

  • @rayannphilip5749
    @rayannphilip57493 ай бұрын

    Thank you Sir. I am already practicing it after a short while 😊

  • @reekdas9219
    @reekdas921911 ай бұрын

    thanks! that was really helpful!

  • @youinagacha8340
    @youinagacha834010 ай бұрын

    Thank you so much my school couldn't teach me that in a month you just did it in a minute

  • @Ololade_dgr8

    @Ololade_dgr8

    9 ай бұрын

    So relatable 😂❤

  • @ulongo123
    @ulongo1233 ай бұрын

    Thank you, big fan out here!!

  • @CindyAudyaPriecillia
    @CindyAudyaPriecillia2 ай бұрын

    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✨

  • @adrian_tr
    @adrian_tr8 ай бұрын

    Thanks. Extremly good explained

  • @jasminecarol3729
    @jasminecarol37292 жыл бұрын

    You just saved my life thank you

  • @AmitBiswas0142
    @AmitBiswas01425 ай бұрын

    Thanks it's working!!

  • @Ksyusha1
    @Ksyusha12 жыл бұрын

    Loved it !

  • @Satorugojo8446
    @Satorugojo844611 ай бұрын

    thank you sir , It helped alot

  • @glorielynasorto2113
    @glorielynasorto21132 жыл бұрын

    thankyou for this video.

  • @payal-Art
    @payal-Art8 ай бұрын

    Thanks a lot 🎉

  • @ArmyPurpleYou_
    @ArmyPurpleYou_ Жыл бұрын

    Ohhh myy godd. It finally worked. Thankyou!!

  • @spudbencer7179
    @spudbencer71795 ай бұрын

    Now try with packages. 1 hour of googling and the java command still doesn't find my class declaration, in the same exact folder

  • @hiteshkalelkar
    @hiteshkalelkar7 ай бұрын

    Thankyou sir this was very helpfull

  • @donnahcolonia25
    @donnahcolonia25 Жыл бұрын

    THANK YOU SO MUCH!!!!!

  • @poovarasanb9210
    @poovarasanb9210 Жыл бұрын

    Amazing tutorial

  • @Jorgerodriguez-cf5vy
    @Jorgerodriguez-cf5vy7 ай бұрын

    Bro, you are awesome.

  • @bipashabanerjee2432
    @bipashabanerjee2432Ай бұрын

    Thank you sir❤

  • @EnglishMediumMathsOL
    @EnglishMediumMathsOL8 ай бұрын

    Informative

  • @user-js8nb2wb4x
    @user-js8nb2wb4x Жыл бұрын

    Thank you john

  • @abdaouihoucine
    @abdaouihoucine4 ай бұрын

    Thanks!

  • @therangolicanvas4127
    @therangolicanvas41272 жыл бұрын

    Very informative thnk u

  • @ericchungu8313
    @ericchungu83132 жыл бұрын

    nice work man

  • @arnavchaudhary4785
    @arnavchaudhary478511 ай бұрын

    Thanks my friend

  • @pigitertin6830
    @pigitertin683011 ай бұрын

    Thank you Sir.

  • @vishakhasoni_07
    @vishakhasoni_07 Жыл бұрын

    Thankyou thankyou thankyou thankyou thankyou thankyou so very much🙂 This has really been very helpful:)

  • @toufikbassam1
    @toufikbassam1 Жыл бұрын

    thank you so much

  • @My_Music001
    @My_Music00112 сағат бұрын

    Thank you . Sir

  • @coderopy
    @coderopy Жыл бұрын

    Thanks very much 🥰

  • @Strawberry12352
    @Strawberry12352 Жыл бұрын

    Thank you so much 🤍

  • @leeamraa
    @leeamraa2 жыл бұрын

    I would've added command line arguments to the tutorial as this is the best way to demo them!

  • @debashisghosh3222
    @debashisghosh3222 Жыл бұрын

    Great video 👏

  • @simple.simple210
    @simple.simple21022 күн бұрын

    THANKS TO YOU SIR MY CODE FINAALY RUN THANK YOU SO MUCH!

  • @afifkhaja
    @afifkhaja Жыл бұрын

    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

  • @parjanyamakeryt528
    @parjanyamakeryt5283 ай бұрын

    Thnq sooooooo much sirrr

  • @avoaveccienna
    @avoaveccienna9 ай бұрын

    John the besttt

  • @megalatest
    @megalatest2 ай бұрын

    Very Nice teach 👍🏻

  • @mrboss8790
    @mrboss87902 жыл бұрын

    Thanks mahn!

  • @happygrace8065
    @happygrace8065 Жыл бұрын

    Maaan!!.. you are the best

  • @matildasgalaxy3204
    @matildasgalaxy32042 ай бұрын

    Thank you so much!!!! Headache gone 😅

  • @komalsingh-b2l
    @komalsingh-b2l7 ай бұрын

    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 ❤❤❤❤❤

  • @davidsalamanca9581
    @davidsalamanca9581 Жыл бұрын

    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 !!

  • @11d7th
    @11d7th Жыл бұрын

    well, dang! thanks you very much!

  • @surajwankhade2082
    @surajwankhade20829 ай бұрын

    Simply explanation

  • @salmasaffir624
    @salmasaffir624 Жыл бұрын

    شكرا 💙

  • @ahmetsagdasli48
    @ahmetsagdasli48 Жыл бұрын

    Thank you :)

  • @winlalitha
    @winlalitha6 ай бұрын

    Thank you

  • @matiascuervo9941
    @matiascuervo99412 жыл бұрын

    Awesome channel, could you do a video about stack and heap memory?

  • @mohammedhishampc8487
    @mohammedhishampc848710 ай бұрын

    thanks man

  • @user-om3yv2qe9x
    @user-om3yv2qe9x8 ай бұрын

    amazing explanation thank you .

  • @pradeepa1612
    @pradeepa1612 Жыл бұрын

    thank you so much....

  • @priavteprospaces3943
    @priavteprospaces39436 ай бұрын

    Thanks help out heaps I sort forgot how change folder in cmd

  • @shirousensei5356
    @shirousensei53564 ай бұрын

    I'm here because my OOP exam requires us to do our hands-on exam on notepad. Lezz goooo

  • @AHMED-ry2gy
    @AHMED-ry2gy2 жыл бұрын

    John can you please do some search algorithms and more sorting videos, thank you

  • @PixelBread01
    @PixelBread018 ай бұрын

    yhank you my guy

  • @MuhammadFarooq-iw5fu
    @MuhammadFarooq-iw5fu2 жыл бұрын

    Awsome!

  • @jop4846
    @jop4846 Жыл бұрын

    amazing. i feel like i can create any app soon.😅

  • @mollaallabakash8433
    @mollaallabakash843310 күн бұрын

    Thank q so 🎉much

  • @user-dn1ku8hl1d
    @user-dn1ku8hl1d10 күн бұрын

    Awesome classes has always. Also, Binding of Isaac! YES

  • @electronoob7341
    @electronoob73412 жыл бұрын

    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.

  • @werq27
    @werq2711 ай бұрын

    Thx)

  • @PhilippexvoliLoL
    @PhilippexvoliLoL Жыл бұрын

    so. clear. :DDDD thanks

  • @upholdjustice372
    @upholdjustice372 Жыл бұрын

    Can you show us if there's a way to view the bytecode and machine code of our Java Program as well? Thanks!

  • @suknayateluguworld1012
    @suknayateluguworld10126 ай бұрын

    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❤

  • @aljei9146
    @aljei9146 Жыл бұрын

    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?

  • @tiagomuniz1043

    @tiagomuniz1043

    Жыл бұрын

    I have the same question...

  • @anas8296
    @anas8296 Жыл бұрын

    Thanks for you effort, Does the class name and the java file name have to be the same?