Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Compiling classes in struts

 
shaf maff
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic