aspose file tools
The moose likes Tomcat and the fly likes Tomcat 6 class in package not found by compiler Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Products » Tomcat
Reply Bookmark "Tomcat 6 class in package not found by compiler" Watch "Tomcat 6 class in package not found by compiler" New topic
Author

Tomcat 6 class in package not found by compiler

Testo Rone
Greenhorn

Joined: Apr 08, 2012
Posts: 5
Hello, i'm still a newbie to java and the tomcat server. On the otherhand i researched quite a lot related to my problem.

I have a compiler error compiling a .java file which is including a class from a package where the file where the to be including class resides has access to.
These files are both in the same package so access to private classes should be granted, but the compiler tells me: "symblo not found" for the "Branch" class.

I'm working on a tomcat 6.0.35 with jdk6

Here are the two files:

1. this is the one in want to compile



2. This one is the one where the class resides in



I get 25 Errors when i'm trying to compile the first file with the following command:

javac -cp /usr/local/tomcat6-php/webapps/ppa/WEB-INF/classes/:/usr/local/tomcat6-php/lib/servlet-api.jar:/usr/local/tomcat6-php/lib/jsp-api.jar GenDisplay\$Branch.jav -Xlint

Errors:
GenDisplay$Branch.java:12: cannot find symbol
symbol : class Branch
location: class ppa.admin.GenDisplay$Branch
protected Branch m_parent;
^
GenDisplay$Branch.java:13: cannot find symbol
symbol : class Branch
location: class ppa.admin.GenDisplay$Branch
protected Branch[] m_children;
^
GenDisplay$Branch.java:17: cannot find symbol
symbol : class Branch
location: class ppa.admin.GenDisplay$Branch
protected GenDisplay$Branch(GenDisplay paramGenDisplay, int paramInt1, Branch paramBranch, int paramInt2, int paramInt3)
^
GenDisplay$Branch.java:33: cannot find symbol
symbol : class Branch
location: class ppa.admin.GenDisplay$Branch
private GenDisplay$Branch(GenDisplay paramGenDisplay, int paramInt, Branch paramBranch, OrdnerIF paramOrdnerIF) {
^
/usr/local/tomcat6-php/webapps/ppa/WEB-INF/classes/ppa/admin/GenDisplay.java:14: cannot find symbol
symbol : class Branch
location: class ppa.admin.GenDisplay
private Branch m_branch;
^
/usr/local/tomcat6-php/webapps/ppa/WEB-INF/classes/ppa/admin/GenDisplay.java:49: cannot find symbol
symbol : class Branch
location: class ppa.admin.GenDisplay
private void genSubTree(Branch branch, JspWriter out) {
^
/usr/local/tomcat6-php/webapps/ppa/WEB-INF/classes/ppa/admin/GenDisplay.java:76: cannot find symbol
symbol : class Branch
location: class ppa.admin.GenDisplay
private void genDisplay(Branch branch, JspWriter out) {
^
/usr/local/tomcat6-php/webapps/ppa/WEB-INF/classes/ppa/admin/GenDisplay.java:139: cannot find symbol
symbol : class Branch
location: class ppa.admin.GenDisplay
private void genForm(Branch branch, JspWriter out) {
^
/usr/local/tomcat6-php/webapps/ppa/WEB-INF/classes/ppa/admin/GenDisplay.java:163: cannot find symbol
symbol : class Branch
location: class ppa.admin.GenDisplay
private boolean isOpen(Branch branch) {
^
/usr/local/tomcat6-php/webapps/ppa/WEB-INF/classes/ppa/admin/GenDisplay.java:173: cannot find symbol
symbol : class Branch
location: class ppa.admin.GenDisplay
private void setOpen(Branch branch, boolean isOpen) {
^
/usr/local/tomcat6-php/webapps/ppa/WEB-INF/classes/ppa/admin/GenDisplay.java:186: cannot find symbol
symbol : class Branch
location: class ppa.admin.GenDisplay
private String getKey(Branch branch) {
^
/usr/local/tomcat6-php/webapps/ppa/WEB-INF/classes/ppa/admin/GenDisplay.java:266: cannot find symbol
symbol : class Branch
location: class ppa.admin.GenDisplay
public Branch findBranch(int id, int type) {
^
/usr/local/tomcat6-php/webapps/ppa/WEB-INF/classes/ppa/admin/GenDisplay.java:270: cannot find symbol
symbol : class Branch
location: class ppa.admin.GenDisplay
private Branch findBranch(Branch branch, int id, int type) {
^
/usr/local/tomcat6-php/webapps/ppa/WEB-INF/classes/ppa/admin/GenDisplay.java:270: cannot find symbol
symbol : class Branch
location: class ppa.admin.GenDisplay
private Branch findBranch(Branch branch, int id, int type) {
^
GenDisplay$Branch.java:63: cannot find symbol
symbol : class Branch
location: class ppa.admin.GenDisplay$Branch
this.m_children = new Branch[i];
^
GenDisplay$Branch.java:64: cannot find symbol
symbol : class Branch
location: class ppa.admin.GenDisplay$Branch
for (int j = 0; j < arrayOfOrdnerIF.length; j++) this.m_children[j] = new Branch(this.this$0, this.m_owner, this, arrayOfOrdnerIF[j]);
^
/usr/local/tomcat6-php/webapps/ppa/WEB-INF/classes/ppa/admin/GenDisplay.java:45: cannot find symbol
symbol : class Branch
location: class ppa.admin.GenDisplay
m_branch = new Branch(m_owner, null, rootId, rootType);
^
/usr/local/tomcat6-php/webapps/ppa/WEB-INF/classes/ppa/admin/GenDisplay.java:60: cannot find symbol
symbol : class Branch
location: class ppa.admin.GenDisplay
Branch child = branch.m_children[i];
^
/usr/local/tomcat6-php/webapps/ppa/WEB-INF/classes/ppa/admin/GenDisplay.java:129: cannot find symbol
symbol : class Branch
location: class ppa.admin.GenDisplay
Branch[] children = branch.m_children;
^
/usr/local/tomcat6-php/webapps/ppa/WEB-INF/classes/ppa/admin/GenDisplay.java:141: cannot find symbol
symbol : class Branch
location: class ppa.admin.GenDisplay
Branch parent = branch.m_parent;
^
/usr/local/tomcat6-php/webapps/ppa/WEB-INF/classes/ppa/admin/GenDisplay.java:212: cannot find symbol
symbol : class Branch
location: class ppa.admin.GenDisplay
Branch branch = findBranch(id, type);
^
/usr/local/tomcat6-php/webapps/ppa/WEB-INF/classes/ppa/admin/GenDisplay.java:230: cannot find symbol
symbol : class Branch
location: class ppa.admin.GenDisplay
Branch[] children = branch.m_children;
^
/usr/local/tomcat6-php/webapps/ppa/WEB-INF/classes/ppa/admin/GenDisplay.java:234: cannot find symbol
symbol : class Branch
location: class ppa.admin.GenDisplay
Branch childBranch = children[i];
^
/usr/local/tomcat6-php/webapps/ppa/WEB-INF/classes/ppa/admin/GenDisplay.java:275: cannot find symbol
symbol : class Branch
location: class ppa.admin.GenDisplay
Branch[] children = branch.m_children;
^
/usr/local/tomcat6-php/webapps/ppa/WEB-INF/classes/ppa/admin/GenDisplay.java:279: cannot find symbol
symbol : class Branch
location: class ppa.admin.GenDisplay
Branch found = findBranch(children[i], id, type);
^
Note: /usr/local/tomcat6-php/webapps/ppa/WEB-INF/classes/ppa/admin/GenDisplay.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
25 errors


What am I doing wrong?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19232

Although $ is valid in Java identifiers, you should never use it in class names. The compiler uses that itself to denote inner classes.

You've created top-level class GenDisplay$Branch. This will be compiled into GenDisplay$Branch.class. The JVM thinks this belongs to nested class GenDisplay.Branch though. This is just how the Java compiler and JVM work.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
Testo Rone
Greenhorn

Joined: Apr 08, 2012
Posts: 5
So how would i have to rename the file for the compiler to understand which class to point to?

Like this: GenDisplayBranch.java

Renaming it like above and compiling again throws the same errors.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Tomcat 6 class in package not found by compiler
 
Similar Threads
Hashmap
Select & Convert Memory Stream Image to PDF File Using Aspose.Pdf
Error at form_TextFiled
mapping xml to java using jaxb
Drop and Add Students to Course