Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

noob cp problems in webapp

 
La Noobie
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to write a simple jsp/servlet app.
I have set up dir structure like this:
-Root
-WEB-INF
-classes
-org
-noobie
-lamer
I have 2 classes called Example1.java and Example2.java both in package org.noobie.lamer.
I cannot compile Example2.java because it cannot find Example1.class. I keep getting unresolved symbol errors. Here is part of my Example2.java.


This is one error:

Both Example1 and Example2 are in package org.noobie.lamer. I am compiling from within the classes/org/noobie/lamer/ directory and Example1.class exists there. Here is my javac command:

So what am I doing wrong?
 
Barry Andrews
Ranch Hand
Posts: 523
C++ Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Compile them both together. javac *.java or better yet check out Ant.

Barry
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need the classes directory in your classpath.
In your case "Root/WEB-INF/classes" must be in the classpath.
-Another Barry
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64982
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do check out ant for simplifying your life immeasurably.
Also, you will find more JSP help in the JSP Forum.
And once you have your web server set up for your app context, the folder /WEB-INF/classes will automatically be in the server's classpath. No other special config is needed.
hth,
bear
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
La Noobie,
Welcome to JavaRanch!
We ain't got many rules 'round these parts, but we do got one. Please change your display name to conform to the JavaRanch naming policy.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic