• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

import statements and the files they import

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 354
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Charles Knell:
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.



So what does your CLASSPATH env variable have, on the computer where it works? Any chance that library has been installed as Extension?
[ September 18, 2007: Message edited by: Abhinav Srivastava ]
 
Charles Knell
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry to trouble you. I have found the solution. I have a <pathelement> nodes defined in my Ant build.xml file, and these point to the appropriate .jar files.

Thanks for your interest.
 
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Charles Knell:
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.



not sure if i fully understand your issue, but here goes.

maybe the .jar file is in the ../bin directory? maybe the .jar file is in the same directory as a file(s) referencing it?
[ September 18, 2007: Message edited by: Michael Raymond Jr. ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic