aspose file tools*
The moose likes Servlets and the fly likes package Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "package" Watch "package" New topic
Author

package

Dennis Liu
Greenhorn

Joined: Dec 03, 2003
Posts: 9
Hi,
I created my own aplication(myApp) under webapps,I put all my own classes under /myApp/WEB-INF/classes.It works fine
I want to put my classes in order.So I created two folders /myApp/WEB-INF/classes/myPackageA and /myApp/WEB-INF/classes/myPackageB
How can one class(A.java) under /myApp/WEB-INF/classes/myPackageA use other class (First.java) under /myApp/WEB-INF/classes
or (B.java) /myApp/WEB-INF/classes/myPackageB?
I put "package myPackageA;" in the first line of A.java and
"package myPackageB;" in the first line of B.java.It doesn't work.
How these classes(First.java,A.java, B.java) can use each other?
Thanks Dennis
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Use import myPackageB.*; in the A.java
Use import myPackageA.*; in the B.java
to import those packages' classes...
But all classes under the /WEB-INF/classes/ is available to all classes by default implementation of the web container...
One thing don't forget to compile the codes again with the package name specified... Hope it helps....


Co-author of SCMAD Exam Guide, Author of JMADPlus
SCJP1.2, CCNA, SCWCD1.4, SCBCD1.3, SCMAD1.0, SCJA1.0, SCJP6.0
Siripa Siangklom
Ranch Hand

Joined: Jan 26, 2004
Posts: 79
Don't forget add "public" precede your class keyword such as
public class A {}
zhu a ming
Greenhorn

Joined: Oct 05, 2003
Posts: 9
!!


=======================<br />s=(LinkNode *)malloc(sizeof(ListNode));<br /> s->date=ch;<br /> s->next=head;<br /> head=s;<br /> ch=getchar();
 
Consider Paul's rocket mass heater.
 
subject: package
 
Similar Threads
Doubt in WEB-INF/lib
Help! Difficult in compiling Servlets
package
How to compile two classes that need each other
Can applet use the jar file in the WEB-INF/lib