wood burning stoves 2.0*
The moose likes Struts and the fly likes Compiling classes in struts 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 » Frameworks » Struts
Bookmark "Compiling classes in struts" Watch "Compiling classes in struts" New topic
Author

Compiling classes in struts

shaf maff
Ranch Hand

Joined: Sep 07, 2008
Posts: 180
Hi Guys

I am new at working with frameworks in java. I have downloaded struts2 and was working on a class. I did the usual and opened up the terminal on my xp64 rig and did the javac MyClass.java but it came out with errors regarding the framework naming. So how do I compile classes in struts?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I'm not sure what you mean by "errors regarding the framework naming". You have to have any S2 dependencies available when you're compiling, just like any other Java program.

It's not terribly efficient to code Java, particularly Java with a lot of dependencies, outside of an IDE, Ant, Maven, or equivalent, but it's doable--you just have to follow normal Java compilation procedures.
shaf maff
Ranch Hand

Joined: Sep 07, 2008
Posts: 180
Thanks for the reply.

Well on compile it tells me the ActionSupport symbol cannot be found. Code below:

import com.opensymphony.xwork2.ActionSupport;
public class ConfirmFault extends ActionSupport {
}

I don't know how to handle th dependiences since I am fresh to this. The apache tuts were talking of maven, I will check that out inabit. But would I paste the jar files into the java lib dir or something ?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You'll get better basic Java support in one of the Java-specific forums; they can talk you through compiling projects with external dependencies.

Maven certainly works, and it's how we build Struts itself, but w/o a decent grip on how Java works in the first place if anything goes wrong you'll be high and dry--it's good to understand the basics of how and why it works, which compiling "by hand" will give you.

When compiling it doesn't matter so much *where* the libraries are located, as long as they're available somehow, either by being on the classpath or via some other mechanism.

When running the webapp they have to be available to the application; in general you won't want them in the JRE/JDK lib dir *or* the app server's lib dir, but in the web-app-specific dir. More information about web app stuff is better asked about in the servlet forum.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Compiling classes in struts
 
Similar Threads
Struts 1 VS Struts 2
dispatcher Vs action dispatcher
Servlet mapping not working after upgrading to Tomcat 6 from Tomcat 5
Configuring DataSource (MYSQL 4.X) in struts-config.xml (Struts 1.2.9) at JBOSS 4.x
Tomcat: Changed JSP not recompiled?