• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem in compiling Action class?

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
 
Naveen Megharaj
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic