?
Solved

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

Posted on 2005-03-19
7
Medium Priority
?
199 Views
Last Modified: 2010-04-01
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
Comment
Question by:dkim18
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 92

Expert Comment

by:objects
ID: 13584479
what directory are your classes in and what is your classpath
0
 

Author Comment

by:dkim18
ID: 13584485
C:\jakarta-tomcat-5.5.4\webapps\~dkim18\WEB-INF\classes\coreservlets>
0
 
LVL 92

Expert Comment

by:objects
ID: 13584490
your compile classpath should contain:
C:\jakarta-tomcat-5.5.4\webapps\~dkim18\WEB-INF\classes
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:dkim18
ID: 13584582
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
 
LVL 92

Accepted Solution

by:
objects earned 280 total points
ID: 13584601
have you added C:\jakarta-tomcat-5.5.4\webapps\~dkim18\WEB-INF\classes to your classpath?
0
 

Author Comment

by:dkim18
ID: 13584669
OK, it worked, but it did compiled ColorBean.java that was in same dir without setting that classpath...
0
 
LVL 92

Expert Comment

by:objects
ID: 13584729
yes, it only needs the classpath set to find classes other than the one you are compiling.
0

Featured Post

Technology Partners: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this modest contribution, I want to share with the IT community (especially system administrators, IT Support Engineers and IT Help Desks) about Windows crashes/hangs and how to deal with these particular problems.
This month, Experts Exchange’s free Course of the Month is focused on CompTIA IT Fundamentals.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question