classpath - Running a java program at the command line, what am I doing wrong? -


Note I'm running windows, the path just looks at it because I have it manually And I think how I think about paths.

I am trying to run Java class which I have created to detect my connections, this refers to the Oracle JDBC adapter.

When I run it without only a classroom path:

 %> Java DBDignostics & lt; ConnectionString & gt;  

I get an exception when I reach the following line of code:

  class. ForName ("oracle.jdbc.pool.OracleDataSource") New difference ();  

with the following exceptions:

  java.lang.ClassNotFoundException: oracle.jdbc.pool.OracleDataSource at java.net.URLClassLoader $ 1.run ( URL class loader java: 200) at java.security.AccessController.doPrivileged (Native method) java.net.URLClassLoader.findClass (URLClassLoader.java:188) on java.lang.ClassLoader.loadClass (ClassLoader.java:307) sun but but. On java.lang.ClassLoader.loadClassInternal (ClassLoader.java:320) on java.lang.Class misc.Launcher $ AppClassLoader.loadClass (Launcher.java:301) java.lang.ClassLoader.loadClass (ClassLoader.java:252) .forName0 (Native method) at DBDiagnostics.runDiagnostic (DBDiagnostics.java:29) on DBDiagnostics.main on java.lang.Class.forName (Class.java:169) DBDiagnostics.GetConnection (DBDiagnostics.java:43) (DBDiagnostics . Java: 18) connection java.sql.SQLException: no suitable driver java.sql.DriverManager.getConnection (DriverManager.java:207) java.sql.DriverManager.getConnection (DriverManager.java:602) on DBDiagnostics.GetConnection got lskd (DBDiagnostics.java: 55) DBDiagnostics.runDiagnostic (DBDiagnostics.java:29 on DBDiagnostics.main) database Apv formula (DBDiagnostics.java:18) On the DBDiagnostics.verifyTable (DBDiagnostics.java:76) on DBDiagnostics.verifyDatabseConnectivity (DBDiagnostics.java:68) on DBDiagnostics.RunDiagnostic on the "main" DBDiagnostics.verifyTable on connectivity to java.lang.NullPointerException (DBDiagnostics.java:86) on connectivity. (DBDiagnostics.java36) on DBDiagnostics.Main (DBDiagnostics.java18)  

I think it's because I have to include it in Kcshapth.

So, I tried to add it Kcshapth such:

 % & gt; Java-ClassPath .: Ojdbc6.jar DBDignostics & lt; ConnectionString & gt;  

VM just could not find the class that says it is:

  exception in thread "main" java.lang.NoClassDefFound error by Dibeedignostiks were: java.lang .ClassNotFoundException: Java on java.net.URLClassLoader $ 1.run java.security.AccessController.doPrivileged (URLClassLoader.java:200) (Native method) java.net.URLClassLoader.findClass (URLClassLoader.java : 188) at DBDiagnostics. On lang.ClassLoader.loadClass sun.misc.Launcher $ AppClassLoader.loadClass (Launcher.java:301) to (ClassLoader.java:307) java.lang.ClassLoader.loadClass (ClassLoader.java:252) on java.lang.ClassLoader .loadClassInternal (ClassLoader.java:320) could not find the main class: Dibeedignostiks program will exit  

I know this is a question I just want to know the answer, but what Am i wrong?

instead of stomach with a semicolon:.

  java -classpath; Connectionstring & gt; Do DBDiagnostics & lt ojdbc6.jar;  

Comments