Hi, it's my understanding that if I want to use a JAR library from within my "Java in the Database" code, I need to include the directory which contains the JAR to my CLASSPATH environment variable. However, this doesn't seem to be working and I get NoClassDefFound errors. I also tried extracting the JAR and setting the CLASSPATH to the root folder of the extracted JAR files, but still no luck. It seems to work if I import every single class from the JAR into the database, but I would really prefer avoiding adding 2000+ classes to the database. Shouldn't the CLASSPATH be used to resolve any missing class dependencies? What am I doing wrong? Thanks! asked 12 Dec '12, 09:39 glitch003 |
You should not be putting the JAR in the classpath. Instead you should be installing the JAR right into the database. Please have a look at the INSTALL JAVA JAR statement. answered 12 Dec '12, 10:33 Karim Khamis Hi, when I try to install the JAR I get errors that classes are already present and the import fails. I can clearly see in Sybase Central > External Environments > Java > Classes that no classes are already present. So importing the JAR fails, and I had to import each class manually into the database. It seems like you're telling me that Java in the Database can only see other classes that have been imported. Is that the case? The documentation seems to imply that classes in the CLASSPATH can be used:
(12 Dec '12, 10:48)
glitch003
When you import a class using the IMPORT JAVA statement do you also get an error?
(12 Dec '12, 21:03)
Derli Marcochi
|