Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Default Package

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
In Java, is there some thing called "Default Package", if there is then how can we import classes from that package to a named package.

ie. In BEA Workshop for WebLogic Version: 10.1, i have created a Java Project and createdan interface " public interface A " which comes under the folder (default package) as i did n't provide a package name.

later when i create a package named "pack" and created a class that needs to implement the above created interface , how can i access it ???

is it possible???
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sreejith kayappuram:
Hi,
In Java, is there some thing called "Default Package", if there is then how can we import classes from that package to a named package.

how can i access it ???

is it possible???



Yes , It is possible, only make sure that you have that default package folder on classpath , !
 
Sreejith kayappuram
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, could you please explain it a bit
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Even though it is possible to use the default package, it is not recommended that you use it at all in web applications because of the fact that web applications often have to deal with multiple class loaders.
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sreejith kayappuram:
Ok, could you please explain it a bit



If you know how to set CLASSPATH variable from command prompt or in system environment, then it is simple OR look here to set classpath variable .
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As of JDK 1.4, you cannot import classes from the default package into non-default classes. See this JSP FAQ entry for more information.
[ June 30, 2008: Message edited by: Bear Bibeault ]
 
Sreejith kayappuram
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok... Once again Thanks all for posting replies
 
reply
    Bookmark Topic Watch Topic
  • New Topic