Hi, I ran into a little question while going through the first java tutorial -
https://coderanch.com/how-to/java/how-to-create-java-program
First of all my java is in the folder located at - C:\Users\Moose\Desktop\Java
I managed to do the javac no problem and create a class with the following code:
C:\Users\Moose>javac Desktop\Java\MooseGreetings.java
However, it failed when I tried to do the following ways for classpath
C:\Users\Moose>java -classpath . Desktop\Java\MooseGreetings
C:\Users\Moose>Desktop\Java>java -classpath MooseGreetings
Now I noticed the > symbol right after "Moose" by default in my command prompt ( C:\Users\Moose> ) and after trying around a few things figured I needed to be able to type out the whole path to execute it. I went to test and got the idea to change it directly on the command prompt by going to properties (as that's all I could think of)
C:\Users\Moose\Desktop\Java>
Then tried again:
C:\Users\Moose\Desktop\Java>java -classpath MooseGreetings
And I got the "moooooooo".
I was quite happy to see that I figured out my problem, however, I'm wondering if there's a way to have the default end with a \ so I can manually type in the rest or if I'm doing something really simple wrong?? Or if simply I should have the default and all my files always in the same place.
Thanks for any help!!