To be able to include
javax.servlet.*
I need the servlet-api.So I went to Tools->Libraries and expected it to be there. I have downloaded the EE edition of NetBeans, that should have it, but I just can't find it. There are tons of stuff like JSF libs etc. that all depend on it in some way, but I can't just pull in the basic servlet api.
For now I ended up with including the external servlet-api jar from tomcat, but this can't be the real solution.
What am I doing wrong? Where is the servlet-api in the NetBeans distribution?
3 comments:
I think servlet-api is being put on classpath as part of the application server classpath. (when creating new web project, you have to pick an app server). Then all the jars found in the appserver are dumped on your project's classpath.
For example maven based projects have a bit of a problem with this setup as well, as the basic maven project doesn't usually have it on classpath, but the various file creation wizards assume it's on classpath of every project.
Milos, that sounds reasonable.
But how can I change a project from 'SE-project' to 'Web-project' or 'EE-project'? I started x2svg as a pure 'SE' project and added the servlet code only later.
I think you need to delete nbproject/ folder and build.xml file and create new web application with existing sources. (to be on the save side, delete the stuff with the IDE not running)
BTW in Maven it would mean changing packaging from "jar" to "war" for the most part.
Post a Comment