• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 202
  • Last Modified:

testing fundamental use of beans and bean class doesn't get recognized.

Hello!

I am just testing fundamental use of beans and I am not sure why "ColorBean" doesn't get recognized.
++++++++++++++++++
package coreservlets;

public class  BeanTester
{
      public static void main(String[] args)
      {
            ColorBean colorBean = new ColorBean();

            colorBean.setForeGround("black");

            System.out.println("foreground: " + colorBean.getForeGround());

            colorBean.setBackGround("white");

            System.out.println("background: " + colorBean.getBackGround());
      }
}
++++++++++++++++++
package coreservlets;

public class ColorBean{

   private String foreGround="";
   private String backGround="";

   public String getForeGround(){
         return (foreGround);
   }

   public void setForeGround(String foreGround){
         this.foreGround=foreGround;
   }

   public String getBackGround(){
         return (backGround);
   }

   public void setBackGround(String backGround){
         this.backGround=backGround;
   }
}
++++++++++++++
if I compile ColorBeanTester.java file, I get this error.
++++++++++++++++
symbol  : class ColorBean
location: class coreservlets.BeanTester
            ColorBean colorBean = new ColorBean();
                ^
...
symbol  : class ColorBean
location: class coreservlets.BeanTester
            ColorBean colorBean = new ColorBean();
+++++++++++++++
thanks,
0
dkim18
Asked:
dkim18
  • 4
  • 3
1 Solution
 
objectsCommented:
what directory are your classes in and what is your classpath
0
 
dkim18Author Commented:
C:\jakarta-tomcat-5.5.4\webapps\~dkim18\WEB-INF\classes\coreservlets>
0
 
objectsCommented:
your compile classpath should contain:
C:\jakarta-tomcat-5.5.4\webapps\~dkim18\WEB-INF\classes
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
dkim18Author Commented:
C:\jakarta-tomcat-5.5.4\webapps\~dkim18\WEB-INF\classes\coreservlets>javac C:\jakarta-tomcat-5.5.4\webapps\~dkim18\WEB-INF\classes\coreservlets\BeanTester.java

this gave me same result.

C:\jakarta-tomcat-5.5.4\webapps\~dkim18\WEB-INF\classes\coreservlets>javac C:\jakarta-tomcat-5.5.4\webapps\~dkim18\WEB-INF\classes\BeanTester.java

if i compile like this, of course cannot fine BeanTester.java file
0
 
objectsCommented:
have you added C:\jakarta-tomcat-5.5.4\webapps\~dkim18\WEB-INF\classes to your classpath?
0
 
dkim18Author Commented:
OK, it worked, but it did compiled ColorBean.java that was in same dir without setting that classpath...
0
 
objectsCommented:
yes, it only needs the classpath set to find classes other than the one you are compiling.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now