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
Please enter at least three characters to search
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

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

Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

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

  • Beyond ChatGPT, AI Reasoning 2.0: Engineering AI Models With Human-Like Reasoning
  • Unlocking the Potential of Apache Iceberg: A Comprehensive Analysis
  • Create Your Own AI-Powered Virtual Tutor: An Easy Tutorial
  • How the Go Runtime Preempts Goroutines for Efficient Concurrency
  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.8K 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
Oops! Something Went Wrong

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:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!