How will I include a Java jar file when compiling a Java class and running the Java file from the command console? -
i have small java file interacting postgresql database, i've downloaded drivers , in file import org.postgresql.driver.
in command console type javac myfilename.java ; compiles run java myfilename , throws error saying can not find org.postgresql.driver files.
so how import jar when run file or when compile file not sure when import should take place?
compile:
javac -cp ".:postresql.jar" -d . myfilename.java run:
java -cp ".:postresql.jar" myfilename
Comments
Post a Comment