I was experimenting with using
JDBC and XML with a reporting system I've developed that uses an Oracle database as the datasource.
Some time back I got everything working nicely on my computer and recently I needed to install the system on another computer. After hacking my way through a connection problem, I've come up against this error message on the new computer:
[
java] Exception in
thread "main" java.lang.NoClassDefFoundError: oracle/xm
l/sql/query/OracleXMLQuery
where the next line calls out the class and method that I wrote in which the error is being thrown.
In my source code I import this class:
import oracle.xml.sql.query.*;
and on my machine there is no error. What has me stumped is, I don't point to the file containing the class with the classpath environment variable, or in any other way that I have been able to see, yet the program does not throw an error when I run it on my computer.
Now I can create a directory on the other computer in the same location and with the same name as the one on my computer, then copy the files there, and hope it will start working, but I still don't understand how Java, running on my computer, can find the .jar file when I don't point to it in some way.
Needless to say, I don't have a lot of confidence in copying the files to the new computer, so I'd like someone, please, to explain how Java "compiles" the imported class when I haven't told it where to find it.
Thanks.