• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Default Package

 
Sreejith kayappuram
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • 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???
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Ok, could you please explain it a bit
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • 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: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • 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 .
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Ok... Once again Thanks all for posting replies
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic