• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

noob cp problems in webapp

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 529
C++ Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Compile them both together. javac *.java or better yet check out Ant.

Barry
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic