...or whatever the location of the driver is. I am assuming you are using Windows®. The dot means, “current directory.” Yes, you do need to include the current directory, or the location of your XXX.java files, otherwise you won't find them. You might only need the quote marks if there are spaces in the names of your folders.javac -cp .;"C:\Program Files\SQLServer\drivers" MyApp.java
javac -cp .;"C:\Program Files\SQLServer\drivers\TheJarfile.jar" MyApp.java
Some people, when well-known sources tell them that fire will burn them, don't put their hands in the fire.
Some people, being skeptical, will put their hands in the fire, get burned, and learn not to put their hands in the fire.
And some people, believing that they know better than well-known sources, will claim it's a lie, put their hands in the fire, and continue to scream it's a lie even as their hands burn down to charred stumps.
Norm Radder wrote:There wasn't any code posted so you can not see if there is an import statement(or reference) for any classes for the SQL driver. If there were, the javac command needs the classpath to point to the jar file with the classes.
If the code does not use any of the classes in the jar file, there is no need to have the classpath point to the jar file for the javac command.
Some people, when well-known sources tell them that fire will burn them, don't put their hands in the fire.
Some people, being skeptical, will put their hands in the fire, get burned, and learn not to put their hands in the fire.
And some people, believing that they know better than well-known sources, will claim it's a lie, put their hands in the fire, and continue to scream it's a lie even as their hands burn down to charred stumps.
Some people, when well-known sources tell them that fire will burn them, don't put their hands in the fire.
Some people, being skeptical, will put their hands in the fire, get burned, and learn not to put their hands in the fire.
And some people, believing that they know better than well-known sources, will claim it's a lie, put their hands in the fire, and continue to scream it's a lie even as their hands burn down to charred stumps.
Some people, when well-known sources tell them that fire will burn them, don't put their hands in the fire.
Some people, being skeptical, will put their hands in the fire, get burned, and learn not to put their hands in the fire.
And some people, believing that they know better than well-known sources, will claim it's a lie, put their hands in the fire, and continue to scream it's a lie even as their hands burn down to charred stumps.
Some people, when well-known sources tell them that fire will burn them, don't put their hands in the fire.
Some people, being skeptical, will put their hands in the fire, get burned, and learn not to put their hands in the fire.
And some people, believing that they know better than well-known sources, will claim it's a lie, put their hands in the fire, and continue to scream it's a lie even as their hands burn down to charred stumps.
Running: "C:\Program Files\Java\jdk1.8.0_60\jre\bin\java.exe" -cp .;pdfbox-app-2.0.8.jar TestCode26
java.class.path=.;pdfbox-app-2.0.8.jar
0 error(s)
Tariqq Mehmoodd wrote:
java.class.path=C:\Users\zanib\Documents\NetBeansProjects\crud\target\classes
java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
Some people, when well-known sources tell them that fire will burn them, don't put their hands in the fire.
Some people, being skeptical, will put their hands in the fire, get burned, and learn not to put their hands in the fire.
And some people, believing that they know better than well-known sources, will claim it's a lie, put their hands in the fire, and continue to scream it's a lie even as their hands burn down to charred stumps.
Norm Radder wrote:Can you copy and paste here what this line prints out when the code is working?
That will help us in the future to debug this type of problem.
Thanks.
Some people, when well-known sources tell them that fire will burn them, don't put their hands in the fire.
Some people, being skeptical, will put their hands in the fire, get burned, and learn not to put their hands in the fire.
And some people, believing that they know better than well-known sources, will claim it's a lie, put their hands in the fire, and continue to scream it's a lie even as their hands burn down to charred stumps.
Norm Radder wrote:Can you copy and paste here what this line prints out when the code is working?
That will help us in the future to debug this type of problem.
Thanks.
Tim Holloway wrote:
In fact, a quick check seems to indicate that Maven is creating a JAR with only his code in it and the "exec" goal is apparently adding the local cached junit and SQL server jars to the execution CLASSPATH.
Norm Radder wrote:Wow! What a lot of configuring. In the end will the OP have a program that can be executed in a command prompt using the java command without having NB or maven around?
Some people, when well-known sources tell them that fire will burn them, don't put their hands in the fire.
Some people, being skeptical, will put their hands in the fire, get burned, and learn not to put their hands in the fire.
And some people, believing that they know better than well-known sources, will claim it's a lie, put their hands in the fire, and continue to scream it's a lie even as their hands burn down to charred stumps.
Like this sir
Some people, when well-known sources tell them that fire will burn them, don't put their hands in the fire.
Some people, being skeptical, will put their hands in the fire, get burned, and learn not to put their hands in the fire.
And some people, believing that they know better than well-known sources, will claim it's a lie, put their hands in the fire, and continue to scream it's a lie even as their hands burn down to charred stumps.
I'm gonna teach you a lesson! Start by looking at this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
|