File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes LoginBean doesn't compile Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "LoginBean doesn Watch "LoginBean doesn New topic
Author

LoginBean doesn't compile

Ricky James
Ranch Hand

Joined: Mar 26, 2007
Posts: 83
Hello,

I am trying to deploy an application from Struts for Dummies. The app has some classes including LoginBean class and a UserDTO class. I am facing problems with these 2. UserDTO compiles ok but when I try to compile LoginBean I get this error:


C:\Documents and Settings\HP_Administrator>cd C:\Program Files\Apache Group\Tomc
at 5.5\webapps\Login5b\source\dummies\struts

C:\Program Files\Apache Group\Tomcat 5.5\webapps\Login5b\source\dummies\struts>j
avac LoginBean.java
LoginBean.java:91: cannot find symbol
symbol : class UserDTO
location: class dummies.struts.LoginBean
UserDTO user = new UserDTO(username, password, age, status);
^
LoginBean.java:91: cannot find symbol
symbol : class UserDTO
location: class dummies.struts.LoginBean
UserDTO user = new UserDTO(username, password, age, status);
^
2 errors


Can someone figure what the problem is. Shall really appreciate.

Thanks in advance.
Ricky James

The code of the 2 files is pasted below:



Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The error message is telling you that you haven't included the UserDTO class in your compile-time classpath when you're trying to compile the LoginBean class.

I'd suggest you not compile classes into the same directory as the source, but specify a different destination directory. Either way, you must include the destination directory in your classpath. example:


Merrill
Consultant, Sima Solutions
Ricky James
Ranch Hand

Joined: Mar 26, 2007
Posts: 83
Originally posted by Merrill Higginson:
The error message is telling you that you haven't included the UserDTO class in your compile-time classpath when you're trying to compile the LoginBean class.

I'd suggest you not compile classes into the same directory as the source, but specify a different destination directory. Either way, you must include the destination directory in your classpath. example:


Hello Merrill,

Thanks for the reply and advice. I tried what you suggested but I got a lot of errors. The whole of the errors are pasted below. I think I might have to add something to the classpath. Can you please advise what I can do?

Thanks in advance.
Ricky

C:\Program Files\Apache Group\Tomcat 5.5\webapps\Login5b>javac -d WEB-INF/classe
s -classpath /WEB-INF/classes source/dummies/struts/*.java
source/dummies/struts/LoginAction.java:3: package javax.servlet.http does not ex
ist
import javax.servlet.http.HttpServletRequest;
^
source/dummies/struts/LoginAction.java:4: package javax.servlet.http does not ex
ist
import javax.servlet.http.HttpServletResponse;
^
source/dummies/struts/LoginAction.java:6: package org.apache.struts.action does
not exist
import org.apache.struts.action.Action;
^
source/dummies/struts/LoginAction.java:7: package org.apache.struts.action does
not exist
import org.apache.struts.action.ActionError;
^
source/dummies/struts/LoginAction.java:8: package org.apache.struts.action does
not exist
import org.apache.struts.action.ActionErrors;
^
source/dummies/struts/LoginAction.java:9: package org.apache.struts.action does
not exist
import org.apache.struts.action.ActionForm;
^
source/dummies/struts/LoginAction.java:10: package org.apache.struts.action does
not exist
import org.apache.struts.action.ActionForward;
^
source/dummies/struts/LoginAction.java:11: package org.apache.struts.action does
not exist
import org.apache.struts.action.ActionMapping;
^
source/dummies/struts/LoginAction.java:13: cannot find symbol
symbol: class Action
public class LoginAction extends Action
^
source/dummies/struts/LoginAction.java:15: cannot find symbol
symbol : class ActionMapping
location: class dummies.struts.LoginAction
public ActionForward execute( ActionMapping mapping,
^
source/dummies/struts/LoginAction.java:16: cannot find symbol
symbol : class ActionForm
location: class dummies.struts.LoginAction
ActionForm form,
^
source/dummies/struts/LoginAction.java:17: cannot find symbol
symbol : class HttpServletRequest
location: class dummies.struts.LoginAction
HttpServletRequest req
uest,
^
source/dummies/struts/LoginAction.java:18: cannot find symbol
symbol : class HttpServletResponse
location: class dummies.struts.LoginAction
HttpServletResponse response) throws Exception

^
source/dummies/struts/LoginAction.java:15: cannot find symbol
symbol : class ActionForward
location: class dummies.struts.LoginAction
public ActionForward execute( ActionMapping mapping,
^
source/dummies/struts/LoginForm.java:3: package javax.servlet.http does not exis
t
import javax.servlet.http.HttpServletRequest;
^
source/dummies/struts/LoginForm.java:5: package org.apache.struts.action does no
t exist
import org.apache.struts.action.ActionError;
^
source/dummies/struts/LoginForm.java:6: package org.apache.struts.action does no
t exist
import org.apache.struts.action.ActionErrors;
^
source/dummies/struts/LoginForm.java:7: package org.apache.struts.action does no
t exist
import org.apache.struts.action.ActionForm;
^
source/dummies/struts/LoginForm.java:8: package org.apache.struts.action does no
t exist
import org.apache.struts.action.ActionMapping;
^
source/dummies/struts/LoginForm.java:10: cannot find symbol
symbol: class ActionForm
public class LoginForm extends ActionForm
^
source/dummies/struts/LoginForm.java:15: cannot find symbol
symbol : class ActionMapping
location: class dummies.struts.LoginForm
public void reset(ActionMapping mapping, HttpServletRequest request)
^
source/dummies/struts/LoginForm.java:15: cannot find symbol
symbol : class HttpServletRequest
location: class dummies.struts.LoginForm
public void reset(ActionMapping mapping, HttpServletRequest request)
^
source/dummies/struts/LoginForm.java:21: cannot find symbol
symbol : class ActionMapping
location: class dummies.struts.LoginForm
public ActionErrors validate(ActionMapping mapping, HttpServletRequest reque
st)
^
source/dummies/struts/LoginForm.java:21: cannot find symbol
symbol : class HttpServletRequest
location: class dummies.struts.LoginForm
public ActionErrors validate(ActionMapping mapping, HttpServletRequest reque
st)
^
source/dummies/struts/LoginForm.java:21: cannot find symbol
symbol : class ActionErrors
location: class dummies.struts.LoginForm
public ActionErrors validate(ActionMapping mapping, HttpServletRequest reque
st)
^
source/dummies/struts/LoginAction.java:32: cannot find symbol
symbol : class ActionErrors
location: class dummies.struts.LoginAction
ActionErrors errors = new ActionErrors();
^
source/dummies/struts/LoginAction.java:32: cannot find symbol
symbol : class ActionErrors
location: class dummies.struts.LoginAction
ActionErrors errors = new ActionErrors();
^
source/dummies/struts/LoginAction.java:33: cannot find symbol
symbol : class ActionError
location: class dummies.struts.LoginAction
ActionError error = new ActionError("error.login.invalid");
^
source/dummies/struts/LoginAction.java:33: cannot find symbol
symbol : class ActionError
location: class dummies.struts.LoginAction
ActionError error = new ActionError("error.login.invalid");
^
source/dummies/struts/LoginForm.java:23: cannot find symbol
symbol : class ActionErrors
location: class dummies.struts.LoginForm
ActionErrors errors = new ActionErrors();
^
source/dummies/struts/LoginForm.java:23: cannot find symbol
symbol : class ActionErrors
location: class dummies.struts.LoginForm
ActionErrors errors = new ActionErrors();
^
source/dummies/struts/LoginForm.java:26: cannot find symbol
symbol : class ActionError
location: class dummies.struts.LoginForm
errors.add("userName", new ActionError("error.username.required"));
^
source/dummies/struts/LoginForm.java:28: cannot find symbol
symbol : class ActionError
location: class dummies.struts.LoginForm
errors.add("password", new ActionError("error.password.required"));
^
Note: source/dummies/struts/LoginBean.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
33 errors

C:\Program Files\Apache Group\Tomcat 5.5\webapps\Login5b>

Vyas
Greenhorn

Joined: May 21, 2007
Posts: 17
This means you have not included all the files necessary for the project to run. It seems you have not included Struts library files. Please collect all necessary files or use Netbeans to work on the example
Ricky James
Ranch Hand

Joined: Mar 26, 2007
Posts: 83
Originally posted by Vyas:
This means you have not included all the files necessary for the project to run. It seems you have not included Struts library files. Please collect all necessary files or use Netbeans to work on the example


Thanks for the reply Vyas. I'll try to use NetBeans.

Ricky
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: LoginBean doesn't compile
 
Similar Threads
Breaking doXXX methods down into smaller ones
Struts Connection pool (please help)
Getting Problem in Delete operation in Struts application
returning an int
data mismatch error