wood burning stoves 2.0*
The moose likes Struts and the fly likes problem in compiling Action class? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "problem in compiling Action class?" Watch "problem in compiling Action class?" New topic
Author

problem in compiling Action class?

Naveen Megharaj
Ranch Hand

Joined: Feb 13, 2009
Posts: 39
i have to java classes in my Struts application:


now the second one:


i m able to compile NameForm.java, but when i compile NameAction.java, i m getting following errors:
NameActio.java:19:can not resolve symbol
symbol:class NameForm
location:class example.NameAction
NameForm nameForm=(NameForm)form:

like this i m getting 4 can not resolve symbol errors.
can anybody help me???
Thank you.
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9280
    
  17

Can you show us the directory structure of your app i.e. the location of the NameForm.java and NameAction.java and how you are compiling these files...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Naveen Megharaj
Ranch Hand

Joined: Feb 13, 2009
Posts: 39
my application's directory structure is as shown below:
StrutsApp
|
|--WEB-INF
| |--classes----example
| |--lib |--NameForm.java
| |--tlds |--NameAction.java
| |--web.xml
| |--struts-config.xml
|--index.jsp
|--displayame.jsp

*)and i have set path and classpath with following values:
path=E:\bea\jdk142_08\bin;E:\progs\StrutsApp\WEB-INF\classes\example;E:\bea\weblogic81\server\lib\weblogic.jar;E:\bea\weblogic81\server\lib\webservices.jar;E:\struts-1.2.6\lib\struts.jar;
classpath=E:\bea\jdk142_08\bin;E:\progs\StrutsApp\WEB-INF\classes\example;E:\bea\weblogic81\server\lib\weblogic.jar;E:\bea\weblogic81\server\lib\webservices.jar;E:\struts-1.2.6\lib\struts.jar;
*)and i m compiling as shown below:
E:\progs\StrutsApp\WEB-INF\classes\example>javac NameAction.java

after above step i m getting four "can not resolve symbol" errors.
But i have successfully compiled NameForm.java file and facing problem in compiling NameAction.java.
can you please see though it.
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9280
    
  17

Naveen, since the classes are in the example package, so you must not compile the files from the example directory. Instead compile the classes from the WEB-INF\classes directory like javac example\NameAction.java.

Also usually a folder named src in the WEB-INF directory is used to store source files i.e. .java files. You can compile .java files in src folder to classes folder (so that the .java files are in src folder and .class files are in classes folder) using the -d flag of the javac command. Search on the internet for more information on the javac command...
Naveen Megharaj
Ranch Hand

Joined: Feb 13, 2009
Posts: 39
i agree with what all you have told.... i tried compiling it from the classes folder as you told, but even then i m getting the same errors. The problem is that the compiler is not able to locate "NameForm.java". if i remove all the statements related to NameForm class in NameAction.java, then it is compiling successfully. one of my friend told that there might be problem with path and classpath!!! what you have to say about this. Please provide some solution.
Thank you.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Why are there JAR files in your path? They're not executable.

You need to include the directory your class files are in on the classpath, although setting a classpath environment variable may not be the most efficient way to do this.
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9280
    
  17

classpath=E:\bea\jdk142_08\bin;E:\progs\StrutsApp\WEB-INF\classes\example;

In your classpath too you've included the example folder, change it to

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem in compiling Action class?
 
Similar Threads
STRUTS
problem with struts-config.xml
ActionForm class
HELP on Struts compile
Help on Symbol not found