Jersey-quickstart-archetype Hello World Example

In this example, we will create a jersey RESTful API web application using jersey-quickstart-webapp maven archetype in eclipse.

Table of Contents

Install remote archetypes in eclipse
Create new maven project using jersey-quickstart-webapp
Generated Files
Run The Application

Install remote archetypes in eclipse

The very first step before creating actual maven quick-start application, is to install quick-start definitions in eclipse. It’s very simple process and I have already covered this information in previous tutorial.

Read More: How to Import Maven Remote Archetype Catalogs in Eclipse

Create new maven project using jersey-quickstart-webapp

Now let’s create new maven project.

Create new maven project
Create new maven project

Select default/other workspace.

Select workspace location
Select workspace location

Select jersey-quickstart-webapp version.

Select jersey quick start version
Select jersey quick start version

Fill artifact Id and Group Id.

Fill Artifact id and Group Id
Fill Artifact id and Group Id

Click ‘OK’ to create this project. Project will be created in workspace.

Generated Files

Let’s look at generated files.

Folder Structure

Default Generated Files
Default Generated Files


<?xml version="1.0" encoding="UTF-8"?>
<!-- This web.xml file is not required when using Servlet 3.0 container,
     see implementation details -->
<web-app xmlns:xsi="" xmlns="" xsi:schemaLocation="; version="2.5">
    <servlet-name>Jersey Web Application</servlet-name>
    <servlet-name>Jersey Web Application</servlet-name>


<project xmlns="" xmlns:xsi=""





            <!-- use the following artifactId if you don't need servlet 2.x compatibility -->
            <!-- artifactId>jersey-container-servlet</artifactId -->
        <!-- uncomment this to get JSON support

package com.howtodoinjava.demo;


 * Root resource (exposed at "myresource" path)
public class MyResource {

     * Method handling HTTP GET requests. The returned object will be sent
     * to the client as "text/plain" media type.
     * @return String that will be returned as a text/plain response.
    public String getIt() {
        return "Got it!";

Run the Application

For hello world usage, you don’t need to do anything in this project. Everything is configured. Just deploy the application.

Hit URL : http://localhost:8080/JerseyDemo/webapi/myresource

Application Output
Application Output

Drop me your questions in comments section.

Happy Learning !!


Notify of
Most Voted
Newest Oldest
Inline Feedbacks
View all comments

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions and frequently asked interview questions.