Ubuntu and writing Java servlets
Kind of a strange, and I'm sure this wouldn't have happened on any other distribution of Linux, but I spent forever looking through blogs, message boards, and all manner of other places looking for an answer to this question.
The problem was with this little itty bitty smidge of code:
Everytime I wanted to compile this, I got something like "Could not find javax.servlet. blah blah" So, eventually, I just pulled an apt-cache search j2 (for j2ee) and saw an entry for libservlet2.4-java. Hmmmmm, what the heck is that I wondered. I installed it and went to the Ubuntu site to look at what files were installed and sure enough:
Perfect! I added these paths to my CLASSPATH variable in my .bashrc and whamo, I'm in business and flaunting my little HelloWorld.class file all around town.
I hope this helps someone else!
The problem was with this little itty bitty smidge of code:
/** * hello.java */ import javax.servlet.*; class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } }
Everytime I wanted to compile this, I got something like "Could not find javax.servlet. blah blah" So, eventually, I just pulled an apt-cache search j2 (for j2ee) and saw an entry for libservlet2.4-java. Hmmmmm, what the heck is that I wondered. I installed it and went to the Ubuntu site to look at what files were installed and sure enough:
/usr/share/java/jsp-api-2.0.jar /usr/share/java/jsp-api.jar /usr/share/java/servlet-api-2.4.jar /usr/share/java/servlet-api.jar
Perfect! I added these paths to my CLASSPATH variable in my .bashrc and whamo, I'm in business and flaunting my little HelloWorld.class file all around town.
I hope this helps someone else!