Running a java program in linux terminal with -class path
Posted
by
Arya
on Stack Overflow
See other posts from Stack Overflow
or by Arya
Published on 2010-12-29T07:42:07Z
Indexed on
2010/12/29
7:54 UTC
Read the original article
Hit count: 242
java
|postgresql
Hello
I've been trying for an hour to run the following program with a the postgresql classpath
class Test{
public static void main(String[] args){
try {
Class.forName("org.postgresql.Driver");
} catch (ClassNotFoundException cnfe) {
System.err.println("Couldn't find Postgresql driver class!");
}
}
}
The program compiled fine with the javac command, but I'm having a hard time running it with the postgresql classpath. I have "postgresql-9.0-801.jdbc4.jar" in the same directory as the file and I tried the following, but non of them worked
java -classpath ./postgresql-9.0-801.jdbc4.jar Test
java -classpath postgresql-9.0-801.jdbc4.jar Test
java -classpath "postgresql-9.0-801.jdbc4.jar" Test
What am I doing wrong?
Regards!
© Stack Overflow or respective owner