Sumant Sankaran wrote:
> package a.b;
> Sample a =new Sample();
> I have got a class.jar that contains just Sample.class ( no package or
> anything,just the class file)
You cannot import from a default package. To use the compiled class
unaltered, you would need to move your class into the same package.
> Please dont ask me to put the Sample.class in a package , I wont be
> able to do that since that jar is actually already available.
Can I ask you to give the person responsible a slap?
Tom Hawtin

Signature
Unemployed English Java programmer
http://jroller.com/page/tackline/
Sumant Sankaran - 16 Sep 2006 16:20 GMT
> Sumant Sankaran wrote:
> > package a.b;
[quoted text clipped - 11 lines]
>
> Can I ask you to give the person responsible a slap?
Unfortunately this was done when the project was being done using
jdk1.3 and importing classes alone was allowed. :(
Thanks for the response Tom
> Tom Hawtin
> --
> Unemployed English Java programmer
> http://jroller.com/page/tackline/
Knute Johnson - 16 Sep 2006 18:16 GMT
Sumant Sankaran wrote:
>> Sumant Sankaran wrote:
>>> package a.b;
[quoted text clipped - 15 lines]
>> Unemployed English Java programmer
>> http://jroller.com/page/tackline/
The simple solution is to unjar the Sample.class file.

Signature
Knute Johnson
email s/nospam/knute/
Knute Johnson - 16 Sep 2006 18:29 GMT
Sumant Sankaran wrote:
>> Sumant Sankaran wrote:
>>> package a.b;
[quoted text clipped - 15 lines]
>> Unemployed English Java programmer
>> http://jroller.com/page/tackline/
Please kindly ignore my last post as that won't work either.
What you can do is create a new class in the default package that
references your Sample.class file and your a.b.Sample1.class. You just
can't reference the default package from another package.
Can anybody explain why that limitation would exist?
Thanks,

Signature
Knute Johnson
email s/nospam/knute/
Andrew Thompson - 16 Sep 2006 18:43 GMT
(no import for default package)
> Can anybody explain why that limitation would exist?
<http://groups.google.com/group/comp.lang.java.programmer/msg/b156ba75c3ec0e8b>
Maybe Sun got sick of people ignoring their strong
hint that once test classes get beyond the 'test'
phase - they should be jar'd.
(I am *way* guilty of deploying default package
classes, it will probably return to bite me in the
posterior when Sun decides to disallow them
from JWS apps. as well! ..groan)
Andrew T.
Sumant Sankaran - 17 Sep 2006 05:18 GMT
> (no import for default package)
> > Can anybody explain why that limitation would exist?
[quoted text clipped - 11 lines]
>
> Andrew T.
Someone helped me out on this issue on another java forum.The only way
to access Sample from Sample1 in such a case is to use reflection. I
guess that works . Thanks guys for all the help
Sumant