This tutorial was originally published on SRF Developer. Check out the blog for the full step-by-step setup.
You have learned the basics of Java (Loops, Classes, Arrays). But your code still only lives in the black console window. ⬛
How do you put Java on the Internet?
In 2025, we don't use raw Servlets or JSP anymore. We use Spring Boot. It is the industry standard that powers companies like Netflix and Uber.
Today, let's build your first "Hello World" website in 3 steps.
🛠️ Step 1: The Setup (Spring Initializr)
You don't need to write configuration files from scratch.
- Go to
start.spring.io - Select Maven and Java.
- Add the "Spring Web" dependency.
- Click Generate & Open in IntelliJ/VS Code.
💻 Step 2: The Code
You only need ONE file to make a web server. Create a simple Controller.
package com.example.demo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloController {
@GetMapping("/")
public String home() {
return "<h1>Hello, World! I built this with Java. 🚀</h1>";
}
}
🚀 Step 3: Run It!
Click the "Run" button in your IDE.
Open your browser and go to http://localhost:8080.
Boom. You are now a Java Web Developer.
##🎯 What's Next? (HTML & Databases)
Sending raw text is boring. You need to learn how to serve real HTML pages and connect to a Database (MySQL).
Top comments (0)