Convert Java Project to Web Project in Eclipse

This tutorial shows you how to convert a Java project to Java web application project in Eclipse 4.2, it should work in older version as well.

1. Java Project

A simple Java project.

java project

2. Project Facets

Right click on the project properties. Select “Project Facets“, and click “convert to faceted form…

project facets

Check “Dynamic Web Module” and “Java“, and specify the value.

project facets

By default, Eclipse will generate all “web” related files (like WEB-INF, web.xml) in a “WebContent” folder. If you want change it to another location, Clicks on the “further configuration available…” link.

Modify Faceted Project

3. Web Application Project

Done, the Java project is converted to web application project, see the globe icon on top of the project.

web project

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider make a donation to these charities.

Comments

Leave a Reply

avatar
newest oldest most voted
Obi
Guest
Obi

Nice tutorial, mkyong. Good job.
Do you know how to convert a web project back to a Java project? I tried unchecking “Dynamic Web Module” and got the error “Dynamic Web Module 3.0 cannot be uninstalled”.
Thanks

Divya
Guest
Divya

superrrr!!

Praveen Srivastava
Guest
Praveen Srivastava

i have created one spring boot project and i want to change “localhost:8080/test” to “www.myname.com”.
i am using Linux web server. how to solve this.

shivam
Guest
shivam

thanks

Trendisoft
Guest
Trendisoft

Well explained. Great post!

ADTC
Guest
ADTC

But I cannot find a “Project Facets” option in Project Properties… why?

Edit: Turns out I was using the basic Eclipse, and not the Eclipse for Java EE. Facets are not available by default in the basic Eclipse. If you want to try using the “Install New Software” thing to get Facets installed, good luck to you. It’s better to just ditch your basic Eclipse and download Eclipse for Java EE.

Pawel
Guest
Pawel

Thank you Mkyong!

Raul
Guest
Raul

Thanks dud. It helped me a lot :)

mcm phenomenon
Guest
mcm phenomenon

???

Dinesh Kumar
Guest
Dinesh Kumar

You are awesome dude :-)

Desiree
Guest
Desiree

Amazing! Its genuinely awesome article, I have got much clear idea about from this article.

dave h
Guest
dave h

This post has helped me many times… thanks for this document… it is a true lifesaver and blessing.

Basavaraj
Guest
Basavaraj

Thanks.

Basavaraj
Guest
Basavaraj

Greta!! thanks

Shivdhwaj Pandey
Guest
Shivdhwaj Pandey

I want to create a simple web project using eclipse helios but cant able to do so in new project there is no option for web projects?

sap
Guest
sap

Hello There. I found your weblog the use of msn. That is a really smartly written article.

I will be sure to bookmark it and return to
read more of your helpful info. Thanks for the post.
I’ll definitely comeback.

harsh
Guest
harsh

thanks, been a quick help in crucial time !

Forhad
Guest
Forhad

I was thinking to do it manually. But this helps me a lot .Simple and basic tool knowledge but effective .

mohsin azeem
Guest
mohsin azeem

any tutorial about pretty faces ? i need that or any good and clear tutorial sites ??

fermovalcan
Guest
fermovalcan

it’s very helpful today

it still works ^ ^

Paul Furbacher
Guest
Paul Furbacher
Editing the .project file to add natures and builders always had a nasty smell to it. I’d do it, but would hold my nose. What’s the point of an IDE if you have to monkey with files it is supposed to be maintaining. At least with Indigo (3.7), I have found it much more convenient (and quicker) to simply open the .settings folder in the Package Explorer, and delete all the files in that folder. If you are nervous about taking such a drastic action, make copies of those files in some other folder before deleting. Then open the project’s… Read more »
trackback
Tip: Convert java project to web project in eclipse | Tecnico Programador

[…] en el siguiente tutorial “convert java project to web project“, podemos conseguirlo. En resumen, es modificar el fichero .project para que incorpore la […]

Kawu
Guest
Kawu

Not sure, but this fix should make this procedure obsolete:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=300182

Elridge
Guest
Elridge

This was very helpful! One thing I had to do to get it to work for me was restart Eclipse after Step 4

Engin
Guest
Engin

Many thanks to Mkyong !
It helped me really !

cirius
Guest
cirius

Thanks a lot for this tip it was very helpful!

DALI MOHAMED
Guest
DALI MOHAMED

Merci beaucoup pour cet explicatif

Sérgio Berlotto
Guest
Sérgio Berlotto

Tks for this tip !
Work fine for me…

jakob
Guest
jakob

thanks, that helped me out!

Raja
Guest
Raja

Excellent