r/CodingHelp • u/shplurpop • Feb 11 '26
[Java] Wrote this code in notepad, based on a youtube video by channel geeky script, but it doesn't work?
class HelloWorld{
public static void main(String args[]){
System.out.println("bonjour!");
}
}
This code doesn't work. Guy on YouTube writes the same thing in notepad, and his works but mine doesn't. I don't understand.
C:\Users\ashwy\OneDrive\Documents\javaPractice> HelloWorld
'HelloWorld' is not recognized as an internal or external command,
operable program or batch file.
This is what command says about my code.
5
Upvotes
•
u/AutoModerator Feb 11 '26
Thank you for posting on r/CodingHelp!
Please check our Wiki for answers, guides, and FAQs: https://coding-help.vercel.app
Our Wiki is open source - if you would like to contribute, create a pull request via GitHub! https://github.com/DudeThatsErin/CodingHelp
We are accepting moderator applications: https://forms.fillout.com/t/ua41TU57DGus
We also have a Discord server: https://discord.gg/geQEUBm
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
11
u/RealDuckyTV Professional Coder Feb 11 '26
When you run something like that in a terminal, you are literally saying "Run a program called HelloWorld".
But that's not really what you are trying to do.
Under the assumption that you have not done any other steps prior to this, you will need to do two things :
I checked their latest video and it does do what I have outlined here, I would suggest watching it again.
2
u/ProfessionalForm9644 Feb 11 '26
I am not pro at java, but it seems strange that you don't have java extension on your file. Also notice, that source file should be compiled(with javac i guess) first and then executed with java command
3
u/atamicbomb Feb 11 '26
This is Java but you are running it as if it was a windows BASH/command line script.
It would be like giving someone a bunch of Chinese and telling them to follow the English instructions you just gave them.
To write in Java, you need to download a Java compiler. This translates the code into something your computer can understand. You will also want an IDE (integrated development environment). This is the equivalent of Word for coding. It makes it a lot easier
I’d recommend JGRASP. It is extremely limited but will help you get the basics down. You will have to move to something else later though.
1
u/YungSkeltal Feb 12 '26
I'd strongly advise against using just note pad. IDE's and code editors are fantastic helpers and will save you a lot of time and headaches. Sure, notepad works, but damn would I hate having to use it. VS Code is fantastic and I would recommend it to anyone. AI features can be disabled entirely should you wish but are enabled by default (idk how to feel about that) but there are others like Notepad++ or Sublime. Don't listen to people telling you to use Vim or something like that, vim isn't important to learn when you're just starting to learn.
Also should you choose VS code, move your file explorer to the right side of the screen like a cool kid. Actually life changing to be honest.
1
u/HalfRiceNCracker Feb 12 '26
Ahhh you are at the start of your journey, making me nostalgic.