Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

About this user

Christopher Dale

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:
/**
 * 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!

Retrieve MSSQL table information

Retrieve tons of information (length, data type, name, etc.) of columns for a table. Works in (T|MS)SQL (all I've tested it in).

SELECT * FROM information_schema.columns WHERE table_name = 'Customers'