I'm using d:\corejava as a current and running folder, where i had set path as "d:\corejava>set path=c:\java\jdk1.6.0_24\bin;".
I created two helper java files i,e D:\corejava\A.java and D:\corejava\B.java and executable java file as "D:\corejava\TestPackage3.java"
I compiled A.java and B.java as "javac -d . A.java" and "javac -d . B.java" Upto here it is good.
I try to set classpath as "D:\corejava>set classpath=D:\corejava;.;" then I compiled TestPackage3.java as "javac TestPackage3.java" here i got error as
TestPackage3.java:6: cannot access A
bad class file: .\A.java
file does not contain class A
Please remove or make sure it appears in the correct subdirectory of the classpath.
A a = new A();
Again I try to set classpath as "D:\corejava>set classpath=D:\corejava\com;.;" then I compiled TestPackage3.java as "javac TestPackage3.java" again I got the same error as above
Again I changed "import com.*" to "import com.A; import com.B" then it is working fine.
Now I want to know is there is any errors in executable file or in helper file or in classpath setting. Anticipating a positive reply.
You are usually better with import com.A; than import com.*;, but please supply more details. If import com.A; works, then import com.*; should work too. Is there something peculiar about your folder structure? Have you got some sort of spelling error?
subject: importing multiple classes from a package