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;