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'm on a Windows system. C:\ is my root. I created the following directory structure: c:\myProject, c:\myProject\source\com\wickedlysmart, c:\myProject\classes. A pojo file named MyClass.java is in the c:\myProject\source\com\wickedlysmart folder. I'm executing the following from the command prompt (I'm currently at the myProject folder): C:\myProject> javac -classpath c:\myProject\source\com\wickedlysmart MyClass.java
This gives me "cannot read: MyClass.java" error. I thought I was telling javac to look in the absolute path "c:\myProject\source\com\wickedlysmart" for this source file. Where did this greenhorn go wrong? Thanks...
Compiling from the command line can using packages and such can take some geting used to. Since it looks like your MyClass.java file is a stand-alone file (i.e. it doesnt reference any classes not currently on the classpath) you actually don't need to specify any classpath. You do however have to specify the path relative to the current directory. And if you want the .class files generated in the classes folder you use the -d option. Try;