What Is Java Hosting?
Java hosting is a server environment with a Java Virtual Machine (JVM) and, in many cases, a Java application server such as Tomcat or Jetty installed to run compiled Java web applications. Because Java applications are deployed as packaged files (JAR or WAR) and run as long-lived processes with their own memory settings, Java hosting is typically offered on VPS, cloud or dedicated plans rather than basic shared hosting.
What runs Java web applications
Java source code is compiled into bytecode, which is then executed by a Java Virtual Machine (JVM) rather than by the operating system directly. Web applications are typically packaged as a WAR (Web Application Archive) file for deployment into an application server such as Apache Tomcat or Jetty, or as a self-contained JAR file for frameworks like Spring Boot that embed their own server. Either way, the hosting environment needs a matching JVM version and enough allocated memory for the application to run.
Common Java hosting components
| Component | Role |
|---|---|
| JDK or JRE | Provides the Java Virtual Machine that executes the application |
| Apache Tomcat or Jetty | Servlet container that runs WAR-packaged applications |
| Spring Boot (embedded server) | Packages its own lightweight server inside a runnable JAR |
| Reverse proxy (Nginx or Apache) | Faces the internet, handles HTTPS, forwards to the Java process |
Deploying a Java application
# Running a Spring Boot style self-contained JAR
java -jar myapp.jar --server.port=8080
# Deploying a WAR file into Tomcat
cp myapp.war /opt/tomcat/webapps/
A reverse proxy is normally placed in front to handle the public ports 80 and 443, forward requests to the internal port the Java process listens on, and manage HTTPS certificates.
Why Java hosting needs more resources
The JVM reserves memory ahead of time based on settings like -Xmx (maximum heap size), and that memory stays allocated for as long as the application runs, regardless of whether it is actively serving traffic at that moment. This makes Java applications heavier on RAM than many PHP sites, which only use resources during an active request. As a result, Java hosting is usually matched with a VPS, cloud instance or dedicated server with enough memory headroom, rather than a low-cost shared plan.
What to check before choosing a Java hosting plan
- Which JDK or JRE version is installed, and whether you can install a different one.
- Whether the plan expects a WAR file for Tomcat or Jetty, or a self-contained JAR you run yourself.
- Available RAM, since the JVM heap size needs to fit comfortably within it.
- SSH access to deploy builds and manage the application as a service.
- How the process is kept running, for example as a systemd service that restarts it automatically.
Frequently asked questions
What is Java hosting?
Java hosting is a server environment that includes a Java Virtual Machine, and often an application server such as Tomcat, so compiled Java web applications packaged as WAR or JAR files can run.
Can I run a Java application on shared hosting?
Rarely. Most shared hosting is built around PHP and does not provide a JVM, the memory headroom, or the process management that Java applications need, so Java apps are typically hosted on a VPS, cloud or dedicated server instead.
What is the difference between a JAR and a WAR file?
A JAR (Java Archive) is a general-purpose packaged Java application, and frameworks like Spring Boot use self-contained JARs that include their own embedded server. A WAR (Web Application Archive) is a packaged web application meant to be deployed into a separate servlet container such as Tomcat or Jetty.
Why does my Java app use so much memory even when idle?
The JVM allocates a heap of memory based on configured limits such as -Xmx when the application starts, and that memory generally stays reserved for the life of the process rather than shrinking when traffic is low.
Do I need Tomcat for every Java web app?
No. Traditional WAR-based applications need a servlet container like Tomcat or Jetty, but many modern frameworks such as Spring Boot embed a lightweight server inside the application itself, so you just run the JAR file directly.
What Java version should I use for hosting?
Use the version your framework and dependencies officially support and test against. Long-term support (LTS) releases are generally the safer choice for production because they receive security updates for a longer period than non-LTS releases.
Related topics
- What Is a VPS (Virtual Private Server)? VPS & Cloud
- What Is Shared Hosting? Hosting Basics
- What Is an SSL Certificate? Security & SSL
- What Is a Dedicated Server? Dedicated Servers
- What Is Web Hosting? Hosting Basics