File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other JSE/JEE APIs and the fly likes package trouble Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "package trouble" Watch "package trouble" New topic
Author

package trouble

dimpsonu arora
Ranch Hand

Joined: Aug 13, 2003
Posts: 51
Hi All,
I am making two directories pack2 and pack3 under c:/java/pack1. The directory structure is:
c:/java/pack1/pack2/abc.java
c:/java/pack1/pack3/hello.java

1.c:/java/pack1/pack2/abc.java
***********abc.java**********

package pack1.pack2;
public class abc
{
public void abc()
{
System.out.println("Hello I am ABC.");
}
}

2.c:/java/pack1/pack3/hello.java
*********Hello.java*********

package pack1.pack3;
import pack1.pack2.*;
public class hello
{
public static void main(String args[])
{
abc obj=new abc();
obj.abc();
System.out.println("Hello World");
}
}

When I try to compile hello.java it gives compilation error at
import pack1.pack2.*; does not exist.
Plz help..............
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Did you compile abc class first?


GenRocket - Experts at Building Test Data
 
Consider Paul's rocket mass heater.
 
subject: package trouble
 
Similar Threads
error while compiling
Compiling java files in different packages with single javac command
Package still not working
package problem
Trouble with packages.