This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am a java beginner, attempting to teach myself the lang. I think that I have a class path problem. My classpath is c:\java
when I write and execute a HelloWorld program in a directory below c:\java (such as c:\java\test) I actually run the version in c:\java.
What do I need to do to fix this?
Second question: I am a procedural programmer who is struggling to understand OOP. Can anyone recommend a book to me that helps me gain a better understanding of OOP specifically, and how to use classes and design program logic using OOP?
Of course. The jvm searches the classpath for a HelloWorld.class and starts in C:\java. Bingo - there is a HelloWorld.class! It doesn't look further into your . dir, because it already found what it was searching for.
Rebooting your computer? Even on windows you don't need to. Redefine the classpath, and reopen a shell. echo %CLASSPATH% and verify that it has changed.
For this atomic issue, you would set it to:
So it will look into the actual directory first.
I guess unsetting the classpath at all will be sufficient to run programs in the actual directory.