In a tomcat JSP application I have this directory layout:
webapps/
myProjectName/
index.jsp
WEB-INF/
classes/
mypackage/
class1.java
class2.java
I'm trying to compile class1.java which references class2.java. It's coded in a form sort of like this:
package mypackage;
public class class1 extends class2 {}
and class2 looks like this:
package mypackage;
public class class2 {}
however, I get an error on class1 saying that class2 cannot be found. First I compiled class2, which compiled just fine, but when I tried to compile class1 it failed, saying that class2 couldn't be found. I tried adding the directory to my classpath (ubuntu) by adding this to /etc/enviornment:
/usr/local/tomcat/webapps/myProjectName/WEB-INF/classes
but it still doesn't compile.
Any idea what's wrong?
The exact error output is this:
javac "Page.java" (in directory: /usr/local/tomcat/webapps/developers/WEB-INF/classes/library)
Page.java:20: cannot find symbol
symbol : class DynamicPage
location: class library.Page
DynamicPage dynamicClasses = {new registerPage()};
^
Page.java:20: illegal initializer for <none>
DynamicPage dynamicClasses = {new registerPage()};
^
Page.java:20: cannot find symbol
symbol : class registerPage
location: class library.Page
DynamicPage dynamicClasses = {new registerPage()};
^
Page.java:34: cannot find symbol
symbol : class DynamicPage
location: class library.Page
DynamicPage selected = null;
^
Page.java:35: cannot find symbol
symbol : class DynamicPage
location: class library.Page
for (DynamicPage dp: dynamicClasses) {
^
5 errors
Compilation failed.
I don't understand why some people are so against using Eclipse or Netbeans (or any IDE). I realise some people prefer manual drive to automatic because you tend to feel the raw power of the engine. I learnt to drive using automatic and then got used to driving manual. I am proficient manual driver now thro learning driving with automatic. I can even handle excavators now, rather proficiently (I dug the hole for the house I am building).
Same with Java. You let Netbeans or Eclipse construct the whole web-app structure for you and then you inspect the structure. Play around with the ant build. Learn from the IDE by mucking around with it.
I know that some people believe that without an IDE, you would expose yourself to the raw compilation process and hence would have a "deeper" understanding of the build process. REALLY? Don't waste your time. Let the IDE do it for you. You will learn the build process faster if you are willing to inspect the files and structure produced by the IDE.