I Installed postgresql and its driver which is "postgresql-9.3-1102.jdbc41.jar".
And my directory seems like :
> SQL
> myJDBC.java
> postgresql-9.3-1102.jdbc41.jar
I have tried :
javac -cp postgresql-9.3-1102.jdbc41.jar myJDBC.java
java -cp postgresql-9.3-1102.jdbc41.jar myJDBC
It compiles fine but when I try to execute it, I get error which is :
Error: Could not find or load main class myJDBC
What am I missing ?
解决方案
The current directory needs to be added to the runtime classpath
java -cp .:postgresql-9.3-1102.jdbc41.jar myJDBC
^