*
The moose likes EJB and other Java EE Technologies and the fly likes Bean is not compiling............... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Bean is not compiling..............." Watch "Bean is not compiling..............." New topic
Author

Bean is not compiling...............

Rashmi Pant
Greenhorn

Joined: Dec 19, 2007
Posts: 25
Hi,
I have one problem.

I am accessing JavaBeans by using jsp.It working but i want to test my bean first and in doing so i am getting an error message.
I have BakedBean.java(JavaBean)file as
----------------------------------------------
package testpackage;

public class BakedBean
{
private String level = "half-baked";
private String goesWith = "hot dogs";

public String getLevel()
{
return(level);
}

public void setLevel(String newLevel)
{
level = newLevel;
}

public String getGoesWith()
{
return(goesWith);
}

public void setGoesWith(String dish)
{
goesWith = dish;
}
}
---------------------------------------------
It is compling very well.Now i have BakedBeanTest.java file which will test above bean but when i am compiling this file i am getting an error message.I have both the files in same package code for this file is as:
-----------------------------------------------
package testpackage;

public class BakedBeanTest
{
public static void main(String[] args)
{
BakedBean bean = new BakedBean();
System.out.println("Original bean: " +
"level=" + bean.getLevel() +
", goesWith=" + bean.getGoesWith());
if (args.length>1)
{
bean.setLevel(args[0]);
bean.setGoesWith(args[1]);
System.out.println("Updated bean: " +
"level=" + bean.getLevel() +
", goesWith=" + bean.getGoesWith());
}
}
}

--------------------------------------------------------------
Will anybody please tell me what is the problem the error which i am getting is as
------------------------------------------------------------
E:\testpackage>javac BakedBeanTest.java
BakedBeanTest.java:7: cannot find symbol
symbol : class BakedBean
location: class testpackage.BakedBeanTest
BakedBean bean = new BakedBean();
^
BakedBeanTest.java:7: cannot find symbol
symbol : class BakedBean
location: class testpackage.BakedBeanTest
BakedBean bean = new BakedBean();
^
2 errors
------------------------------------------------------------
Please tell me solution for this
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41066
    
  43
It will work if you change the directory to be one level higher, i.e. directly in the E:\ directory. If you then use "javac testpackage\BakedBeanTest.java" the other class will be found (because the directory hierarchy hatches the package hierarchy).

Alternatively, you can compile both classes in one go: "javac *.java".


Ping & DNS - my free Android networking tools app
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41066
    
  43
Please UseTheForumNotEmail and RespectYourCoranchersPrivacy.
 
jQuery in Action, 2nd edition
 
subject: Bean is not compiling...............
 
Similar Threads
please help me to resolve this problem
compiling package program error
Package Problem
how to compile
unable to compile servletListener