简体   繁体   中英

compile java class with jdbc using command prompt

I want to compile a java servlet file which includes jdbc using command promp. For this I have used the following command: -cp .;"C:\\MyWebProject2\\tomcat\\lib\\servlet-api.jar;C:\\MyWebProject2\\tomcat\\webapps\\database\\WEB-INF\\lib\\ojdbc6-11.2.0.2.0.jar "DatabaseAccess.java

Here, my servlet-api.jar file is in the dir "C:\\MyWebProject2\\tomcat\\lib\\" and ojdbc.jar file is in the dir "C:\\MyWebProject2\\tomcat\\webapps\\database\\WEB-INF\\lib\\"

But, I'm recieving output like the following: javac: no source files Usage: javac <options> <source files> use -help for a list of possible options

My environment variables are:

CATALINA_HOME = C:\\MyWebProject2\\tomcat CLASSPATH = %JAVA_HOME%\\bin;%JRE_HOME%\\bin;%CATALINA_HOME%\\lib JAVA_HOME = C:\\Program Files (x86)\\Java\\jdk JRE_Home = C:\\Program Files (x86)\\Java\\jre

I am on windows

There should be a space after quote (") and before your java class name.

-cp .;"C:\\MyWebProject2\\tomcat\\lib\\servlet-api.jar;C:\\MyWebProject2\\tomcat\\webapps\\database\\WEB-INF\\lib\\ojdbc6-11.2.0.2.0.jar" DatabaseAccess.java

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM