DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Related

  • Installing Open JDK 8 on Ubuntu
  • Jakarta WebSocket Essentials: A Guide to Full-Duplex Communication in Java
  • Java Is Greener on Arm
  • Mastering Date/Time APIs: Challenges With Java's Calendar and JDK Date/Time APIs

Trending

  • Build a Simple REST API Using Python Flask and SQLite (With Tests)
  • MCP Servers: The Technical Debt That Is Coming
  • Optimizing Integration Workflows With Spark Structured Streaming and Cloud Services
  • Can You Run a MariaDB Cluster on a $150 Kubernetes Lab? I Gave It a Shot
  1. DZone
  2. Coding
  3. Java
  4. How to Set Up JDK and Tomcat on Ubuntu

How to Set Up JDK and Tomcat on Ubuntu

This quick tutorial will guide you in setting up the latest JDK and Tomcat on Ubuntu, complete with the necessary code and commands.

By 
Mafijur Rahman user avatar
Mafijur Rahman
·
Dec. 29, 17 · Tutorial
Likes (6)
Comment
Save
Tweet
Share
8.9K Views

Join the DZone community and get the full member experience.

Join For Free

Step 1: Download the latest JDK and Tomcat (in this article, I am using JDK 9 and Tomcat 9).

Step 2: Change the permissions and ownership of the "opt" directory.

user@group:~$ chown username:groupname /opt -R
user@group:~$ chmod 755 /opt -R

Step 3: Now unzip the JDK and Tomcat zip files and copy them to the "opt" directory.

 user@group:~$ cp Downloads/jdk-9.0.1 -Rf /opt/
 user@group:~$ cp Downloads/apache-tomcat-9.0.1 -Rf /opt/tomcat-9

Step 4: Now we need to add some lines to the bottom of the "bashrc" file. To open the "bashrc" file:

 user@group:~$ vim .bashrc

Then press "i" to enable insert mode.

Now add these lines to end of "bashrc":

export CATALINA_HOME=/path/of/tomcat
export CATALINA_OPTS="-Xms256m -Xmx512m -XX:MaxPermSize=128m" 
export MAVEN_OPTS="-Xms256m -Xmx512m" 
export JAVA_HOME=/path/of/jdk 
export JDK_HOME=/path/of/jdk
export IDEA_JDK=/path/of/jdk
export M2_HOME=/path/of/maven 
export PATH=${JAVA_HOME}/bin:${M2_HOME}/bin:${PATH}

After adding the lines, press "Esc" to enable read-only mode. After that, press "Shift + ;" and type "wq" to save the "bashrc" file.

Then, run the following command to set the source of the "bashrc" file:

 user@group:~$ source .bashrc

To check the Java version:

 user@group:~$ java ­-version 

It will show results like so:

Java version "9.0.1" 
Java(TM) SE Runtime Environment (build 9.0.1+11) 
Java HotSpot(TM) 64­Bit Server VM (build 9.0.1+11, mixed mode)

Now start the Tomcat server by running the following command:

 user@group:~$ /path/to/tomcat/bin/startup.sh 

Note: “user@group:~$” is your system default. Don't need to copy it.

Java (programming language) Java Development Kit Apache Tomcat ubuntu

Opinions expressed by DZone contributors are their own.

Related

  • Installing Open JDK 8 on Ubuntu
  • Jakarta WebSocket Essentials: A Guide to Full-Duplex Communication in Java
  • Java Is Greener on Arm
  • Mastering Date/Time APIs: Challenges With Java's Calendar and JDK Date/Time APIs

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: