Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Compilation Problem with Packages

  Asked By: Don    Date: Jul 22    Category: Java    Views: 562
  

Hope you all are fine. But, I am not, due to the following problem! I need your
help!

I have written the follwing 2 java classes in 2 ".java" files in the same
package i.e. "package jspcr.taglib.util;"

Yes, they are in the files, named SwitchTag.java and CaseTag.java only. Not with
different names.

In both the files the package statement i.e. "package jspcr.taglib.util;" is
declared in the first line as the rule is. And both the files are in the
"C:\Tomcat 1.4\webapps\examples\WEB-INF\classes\jspcr\taglib\util" directory
itself. So there is no problem in that respect.

But, when I try to compile them, "SwitchTag.java" gets compiled without any
trouble. And, I get the class file i.e. "SwitchTag.class".

Now, when I try to compile "CaseTag.java" it throws the following 3 compilation
errors, all in the below mentioned line of code, as the class name "SwitchTag"
has been used in 3 places in this line of code.

SwitchTag switchTag = (SwitchTag) findAncestorWithClass(this, SwitchTag.class);

The compiler here doesn't find the SwitchTag class.

I need this help very urgently from you all. Please let me know the reason and
the way to overcome the problem. Your help would be highly appreciated and
remembered.

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Leon Evans     Answered On: Jul 22

Make sure the file SwitchTag.java is in the classpath for the
compilation. If you are compiling from the directory that contains the
file SwitchTag.java, try this:
javac -classpath . SwitchTag.java

 
Didn't find what you were looking for? Find more on Compilation Problem with Packages Or get search suggestion and latest updates.




Tagged: