Error while importing user created packages
Hi ,
Complexity Novice
Problem Description
-
I am trying to run a simple package related program.
The package file is perfectly compiled and stored in the required path.
When I try to access this package from another file -- the import statement does not seem to be working.
It reports an error. However If I use the <pacakage>.<classname> it works perfectly fine.
I have the following files
1) The package file : Get.java
2) The package accessing file : Test.java
///////////////Get.java/////////////////////
package get;
publicclass Get
{
public Get()
{
}
public String iGet()
{
return("Hello World!");
}
}
/////////////////////Test.java/////////////////
import get.*;
class Test
{
publicstaticvoid main(String[] args)
{
Get g=new Get();//Here instead I use get.Get g= new get.Get() it works fine
System.out.println("Hello World!");
}
}
///////////////////End of Files////////////////
/////// Compiling/////////////
c:\packages>dir *.java//These are the only 2 files in the directory
10/05/2005 12:02 AM147 Test.java
10/04/2005 11:55 PM125 Get.java
c:\packages>javac -d . *.java
.\Get.java:3: duplicateclass: get.Get
publicclass Get
^
Test.java:7: cannot resolve symbol
symbol : constructor Get ()
location:class Get
Get g=new Get();
^
2 errors
I think the problem is clearly explained.
Thanks in advance

