Follow me as I struggle with rogue technology, insane programmers, and impossible math questions in a battle to the death.

Friday, May 22, 2009

Using the Java Classpath at the command line

One of the most irritating things about Java is the classpath.

Here's the command on UNIX:

java -cp /Users/jacob/foo.jar:. foo/bar

Here's how to do it on Windows:

java -cp C:\jacob\foo.jar;. foo/bar

The annoying part is that you can't use relative path names. You must put the absolute path for each directory and jar file. Also, on UNIX you separate each path with a semicolon, while on Windows you separate using a semicolon.

Use the -cp flag, then reference you class. Don't append the .class file extension to the name of class, just provide the path relative to where you are executing the Java command.

Labels:

Wednesday, May 20, 2009

Create a postgresql database

How to add postgresql user account

# adduser tom
# passwd tom

# sudo su -
(or might be # su - postgres)

$ psql -d template1 -U postgres

template1=# CREATE USER tom WITH PASSWORD 'myPassword';
template1=# CREATE DATABASE jerry;
template1=# GRANT ALL PRIVILEGES ON DATABASE jerry to tom;

template1=# \q

$ su - tom
$ psql -d jerry -U tom

Labels:

Tuesday, May 05, 2009

MySql Installation Problem and resolution

A lot of times I've encountered this problem installing MySQL.

When it goes to turn on the service at the end of the installation process, the software firewall stops it from starting the service. When this happens, the security is not applied. Then, I try to run the installation again, and when I get to the point where I'm setting the password, there are 3 password fields instead of 2. Since the the security settings were never applied, there is no password for the first field! But usually I end up trying to put a password in that field, and as a result MySQL fails when it tries to apply security settings.

So, leave that field blank.

Labels: