aspose file tools*
The moose likes Struts and the fly likes Default Package Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Default Package" Watch "Default Package" New topic
Author

Default Package

Sreejith kayappuram
Ranch Hand

Joined: Jun 24, 2008
Posts: 35
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???


Thanks
Sreejith
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

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 , !


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Sreejith kayappuram
Ranch Hand

Joined: Jun 24, 2008
Posts: 35
Ok, could you please explain it a bit
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
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.


Merrill
Consultant, Sima Solutions
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

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

Joined: Jan 10, 2002
Posts: 61206
    
  66

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 ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Sreejith kayappuram
Ranch Hand

Joined: Jun 24, 2008
Posts: 35
Ok... Once again Thanks all for posting replies
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Default Package