Struts Tutorial «Prev  Next»

Downloading and Setting Up Apache Struts (Legacy Framework)

Understanding This Tutorial's Context

Apache Struts was one of the dominant Java web frameworks from the early 2000s through the mid-2010s. While Spring Framework (particularly Spring Boot) has largely replaced Struts in modern development, many organizations still maintain Struts-based applications. This tutorial serves developers who need to work with legacy Struts codebases or understand historical Java web development patterns.

If you're starting a new Java web project in 2026, Spring Boot is the recommended choice. However, learning Struts remains valuable for maintaining existing enterprise applications, understanding the evolution of Java web frameworks, or working in organizations with significant Struts investments.

Why Struts Became Popular (Historical Context)

Released in 2000, Apache Struts introduced the Model-View-Controller (MVC) pattern to Java web development at a time when most developers were writing servlet code with embedded HTML. Struts provided:

By 2010, however, Spring MVC emerged with annotation-based configuration and more flexible architecture. Today, Spring Boot's convention-over-configuration approach and embedded server support make it the industry standard for Java web development.

Prerequisites: Installing a Modern JDK

While Struts was originally developed for Java 1.4 and 1.5, modern Struts versions support current JDK releases. For this tutorial, we'll use Java 17 or later (Java 17, 21, or 25), as these are the current Long-Term Support (LTS) releases.

Step 1: Download the JDK

Download the latest Java Development Kit from Oracle or adopt an open-source alternative:

Step 2: Install and Configure the JDK

Modern JDK installers typically handle PATH configuration automatically. However, if manual configuration is needed:

Windows Configuration

  1. Install the JDK to a location like C:\Program Files\Java\jdk-25
  2. Right-click "This PC" or "My Computer" → Properties
  3. Click "Advanced system settings" → "Environment Variables"
  4. Under "System Variables", create or edit:
    • JAVA_HOME = C:\Program Files\Java\jdk-25
    • PATH - Add %JAVA_HOME%\bin to the existing PATH

Linux/Mac Configuration

For bash shell, add to ~/.bashrc or ~/.bash_profile:


export JAVA_HOME=/usr/lib/jvm/jdk-25
export PATH=$JAVA_HOME/bin:$PATH

For zsh shell (default on modern Macs), add to ~/.zshrc:


export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-25.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH

Step 3: Verify Installation

Open a new terminal or command prompt and verify:


java -version
javac -version

Both commands should display version information for Java 17 or later.

Downloading Apache Struts

Apache Struts is available in two major versions: Struts 1.x (legacy, end-of-life) and Struts 2.x (still maintained). For learning purposes or legacy maintenance, you'll likely need Struts 2.x.

Option 1: Download from Apache (Manual)

  1. Visit the Apache Struts homepage
  2. Navigate to the Downloads section
  3. Download the latest Struts 2.x release (ZIP or tar.gz)
  4. Extract to a working directory like C:\struts or ~/struts
  5. The distribution includes:
    • lib/ - JAR files for your classpath
    • apps/ - Sample applications
    • docs/ - Documentation

Option 2: Maven Dependency (Recommended for Modern Development)

If you're setting up a new Struts project or maintaining an existing Maven-based project, add Struts as a dependency in your pom.xml:


<dependency>
    <groupId>org.apache.struts</groupId>
    <artifactId>struts2-core</artifactId>
    <version>6.4.0</version>
</dependency>

Maven will automatically download Struts and all required dependencies.

Option 3: Gradle Dependency

For Gradle projects, add to your build.gradle:


dependencies {
    implementation 'org.apache.struts:struts2-core:6.4.0'
}

IDE Configuration

Modern IDEs handle JDK and framework configuration automatically. If you're using IntelliJ IDEA, Eclipse, or NetBeans:

  1. Create a new Java Web Project or Maven/Gradle project
  2. The IDE will detect your installed JDK
  3. Add Struts JARs to your project's classpath (or use Maven/Gradle dependencies)
  4. Configure your web.xml to include the Struts filter

Modern Alternative: Spring Boot

Before investing significant time in Struts, consider whether Spring Boot might be a better fit for your needs:


Aspect Apache Struts Spring Boot
Initial Release 2000 (Struts 1), 2006 (Struts 2) 2014
Configuration XML-based or annotations Annotation-based, minimal configuration
Learning Curve Moderate to steep Easier for beginners
Community & Support Small, declining Very large, growing
Security Updates Still maintained but slower Frequent updates
Job Market Legacy maintenance roles High demand, modern development

When to Use This Struts Tutorial

You should proceed with learning Struts if you:

If you're starting fresh with no legacy constraints, begin with Spring Boot instead. Spring Boot offers better tooling, documentation, community support, and career prospects in 2026.

Next Steps

Now that you have the JDK installed and understand Struts' place in the Java ecosystem, you're ready to create your first Struts application. The next lesson will guide you through:

Remember: Struts knowledge remains valuable for maintenance scenarios, but stay informed about modern alternatives to make informed technology choices for new projects.

SEMrush Software