• 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

Java Bean Sub Classes

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Alright...

I am creating a bunch of beans.... magic beans?

anyway

I have 2 classes

Parameters.java


and
Contacts.java


both of these files exist in
myapp/WEB-INF/classes/com/

I get an error when compiling Contacts.java



how can you pull from another class succesfully
 
Ranch Hand
Posts: 657
Spring VI Editor Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

You get a "cannot resolve symbol" message because the compiler can't find your class. The way to remedy this is to ensure that your class is included in the classpath. The example assumes that you are in the classes directory.

Javapedia: Classpath
How Classes are Found
[ May 05, 2005: Message edited by: Steve Morrow ]
 
Steve Morrow
Ranch Hand
Posts: 657
Spring VI Editor Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
P.S. You probably will have an easier time if you don't store your source tree in the /WEB-INF/classes directory...
 
icredes
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
where should it be instead?
 
Steve Morrow
Ranch Hand
Posts: 657
Spring VI Editor Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

where should it be instead?

Your source code? Wherever you want. But I like to keep the source and compiled classes separate; it makes clean builds much easier/less dangerous.
 
icredes
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
do I need to reset my class path for every application?
and if so how?
 
icredes
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok...

I got it to work

what I had to do was compile it from

/webapp/classes/

javac com/Parameters.java
javac com/Contacts.java

This worked...

Why? do I have to compile all packaged classes from the reference of the classes folder?
 
Steve Morrow
Ranch Hand
Posts: 657
Spring VI Editor Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by James Todd:
do I need to reset my class path for every application?
and if so how?

I don't recommend setting a system classpath at all. I recommend specifying the classpath as an argument or within the context of your application (IDE setting, etc.).
 
Steve Morrow
Ranch Hand
Posts: 657
Spring VI Editor Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

what I had to do was compile it from

/webapp/classes/

Yeah, that's kind of what I pointed out...

This worked...

Why? do I have to compile all packaged classes from the reference of the classes folder?

It worked because that's what the compiler expects. Check out those links I posted, and get yourself familiar with how the classpath operates. It'll ease many future headaches, I guarantee.

Also, if you haven't yet heard of Apache Ant, you'll want to do yourself a favor and learn about it, quickly.
 
Talk sense to a fool and he calls you foolish. -Euripides A foolish tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic