• 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

getting beans to see each other

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm having a problem compiling a bean which uses another bean in the same package. I compile GuestBean first, in package com.deitel.advjhtp1.jsp.beans, which works OK. Then I try to compile GuestDataBean, which uses instances of GuestBean. Both have the same package statement. The compiler says:
C:\devel\jsp-intro\WEB-INF\classes\com\deitel\advjhtp1\jsp\beans\GuestDataBean.java:61: cannot resolve symbol
symbol : class GuestBean
location: class com.deitel.advjhtp1.jsp.beans.GuestDataBean
public void addGuest( GuestBean guest ) throws SQLException
^
C:\devel\jsp-intro\WEB-INF\classes\com\deitel\advjhtp1\jsp\beans\GuestDataBean.java:48: cannot resolve symbol
symbol : class GuestBean
location: class com.deitel.advjhtp1.jsp.beans.GuestDataBean
GuestBean guest = new GuestBean();
^
C:\devel\jsp-intro\WEB-INF\classes\com\deitel\advjhtp1\jsp\beans\GuestDataBean.java:48: cannot resolve symbol
symbol : class GuestBean
location: class com.deitel.advjhtp1.jsp.beans.GuestDataBean
GuestBean guest = new GuestBean();
^
3 errors

Why can't it see the GuestBean? (I can only get them to cooperate by putting them in the same file...)
Thanks
 
Lucy Smaile
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe it's a classpath problem. I'm on win98.
I tried adding the following to autoexec.bat, but it didn't help:
set classpath=.;c:\devel\jsp-intro\WEB-INF\classes\com\deitel\advjhtp1\jsp\beans
I also tried:
set classpath=%classpath%c:\devel\jsp-intro\WEB-INF\classes\com\deitel\advjhtp1\jsp\beans
Have deleted them again...
Please help!
Thanks
 
Author
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Lucy Smaile:
Maybe it's a classpath problem. I'm on win98.
I tried adding the following to autoexec.bat, but it didn't help:
set classpath=.;c:\devel\jsp-intro\WEB-INF\classes\com\deitel\advjhtp1\jsp\beans
I also tried:
set classpath=%classpath%c:\devel\jsp-intro\WEB-INF\classes\com\deitel\advjhtp1\jsp\beans
Have deleted them again...
Please help!
Thanks



both the package root and the location of the source file itself must be in the classpath. So when compiling BOTH of the classes, you MUST have
c:\devel\jsp-intro\WEB-INF\classes\
int he classpath, and assuming that you are compiling from the same folder as the files are in, you should also add . as you have been doing
 
Lucy Smaile
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you! Now it works.
reply
    Bookmark Topic Watch Topic
  • New Topic