#Java begginer code won't work

12 messages · Page 1 of 1 (latest)

south void
#

Hi! I just started learning Java on w3schools and the first example I tried to do doesn't work.
I copied the code from w3 to my notepad, saved the file as Main.java to my desktop, and the command prompt returns an error, when it should give an output Hello World
Can anyone help?

sick raven
#

try entering into the command prompt: cd Desktop, and then: java Main.java
does it work then?

south void
#

Wow, it works! Thank you!!! @sick raven

#

Just a side question: what does "cd" mean? I mean why did this solve the problem?

sick raven
#

cd means you change the directory

south void
#

Aaaaa okay... what's the default directory?

sick raven
#

your user direcory, so if you want to run a file on your desktop you have to change the directory

south void
#

Okay..sorry if I'm being a bit dense here, just - where would I need to save the file in order not to have to change the directory?

sick raven
#

in C:\Users\golou

south void
#

Aaaaa okay, thank you very much!

#

☺️