Reputation:
In visual studio 2003's project settings, I specified the java.exe as the program to execute when debugging. I set the working directory in which the JNI dlland JNI jar is available.
I set the class paths and the command line arguments which I would pass to java in the program arguments.
The java file which I am using is compiled with the JNI jar file. In the java file I am trying to connect to a particualr driver using the following code. Driver d = (Driver)Class.forName(drivername).newInstance();
// GET CONNECTION con = DriverManager.getConnection(URL,user,password);
When running the java file in Visual studio I get the error "driver name not found".The visual studio not loading the jar file properly. How to resolve this problem without using eclipse?
Thanks in Advance.
Upvotes: 0
Views: 407
Reputation: 39606
This sounds like a classpath problem, not a JNI problem.
Eclipse builds up a classpath for you, from the libraries/projects that you specify in the build path. When you're running from Visual Studio, you'll have to create that classpath yourself. Assuming that you can pass command-line arguments when you start java.exe
from Visual Studio, add the -cp
argument as described here: http://java.sun.com/javase/6/docs/technotes/tools/windows/java.html
Upvotes: 1