Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

getting beans to see each other  RSS feed

 
Lucy Smaile
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
chanoch wiggers
Author
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Thank you! Now it works.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!