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

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -