When I try to run Java application, I receive the following error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no ocijdbc9 in java.library.path
I don't have a file ocijdbc9.* on my PC, but I have ocijdbc10.dll in %ORACLE_HOME%\bin.
%ORACLE_HOME% is correctly specified, so I think the problem is that the application is searching for the wrong version (9 instead of 10).
Both Oracle and Java Builder are freshly installed, so the problem may be in project preferences? Do you have any ideas on how to search for the place where the wrong version is specified?
You're missing a file from your java CLASSPATH.
You need to add the OCI jar to your classpath.
For my oracle 10.0.2 install on windows it's located in
%ORACLE_HOME%\jdbc\lib\ojdbc14.jar
If your application requires ocijdbc9 then you'll have to download it from somewhere and add it to the CLASSPATH. I don't know where to download it from, try the oracle site
an additional tip:
if you're using oci jdbc urls; it is always better to use the jar library of your oracle client version.
please check this address for these libraries: http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html
for example if your client is Oracle 10.2.0.4, then you'd better use this client's ojdbc14.jar for java >= 1.4 and classes12.jar for java <= 1.3
note that until Oracle 11, jdbc libraries have the same names in every version such as ojdbc14.jar and classes12.jar.
You need to pass -Djava.library.path=YOUR_ORACLE_HOME\bin to the JRE as a runtime parameter
So....
java [other java switches + runtime parameters] -Djava.library.path=YOUR_ORACLE_HOME\bin run-classname
I think it is because you have not yet installed Oracle Client.
After installing it, maybe it is ok
Related
I've created a Matlab's function that I want to call from a Java App. Since I don't have matlab installed in this machine I use Matlab Runtine (version 8.5, 32 bits).
When I execute the code, I get this error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Failed to find the required library mclmcrrt8_5.dll on java.library.path.
This library is typically installed along with MATLAB or the MCR. Its absence may indicate an issue with that installation or the current path configuration.
The MCR version that this component is trying to use is: 8.5.
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$ProxyLibraryDir.get(MCRConfiguration.java:259)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$ProxyLibraryDir.<clinit>(MCRConfiguration.java:265)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration.getProxyLibraryDir(MCRConfiguration.java:270)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$MCRRoot.get(MCRConfiguration.java:71)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$MCRRoot.<clinit>(MCRConfiguration.java:81)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration.getMCRRoot(MCRConfiguration.java:86)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration$ModuleDir.<clinit>(MCRConfiguration.java:60)
at com.mathworks.toolbox.javabuilder.internal.MCRConfiguration.getModuleDir(MCRConfiguration.java:65)
at com.mathworks.toolbox.javabuilder.internal.MWMCR.<clinit>(MWMCR.java:1503)
at BCI.BCIMCRFactory.newInstance(BCIMCRFactory.java:60)
at BCI.BCIMCRFactory.newInstance(BCIMCRFactory.java:71)
at BCI.Class1.<init>(Class1.java:104)
at bci.pruebaEEG.main(pruebaEEG.java:24)
I've included to my PATH environment's variable the dll's path:
C:\Program Files (x86)\Matlab\Matklab Runtime\v85\runtime\win32
Matlab's version used to create the previous function was R2015a (32bits) and to compile the Java Package, jdk 1.7 (they're supposed to be compatible).
Can anyone help me??
Thanks in advance!
Okay, I was able to find the solution to my dll's problem. So, if someone else is also getting continuously this "Failed to find the required library mclmcrrt8_5.dll on java.library.path." error and has already followed this steps, please check if your jre version matches with the 32/64 bits version of the matlab compiler (MCR)
I was running my Java application from Eclipse and fool of me I didn't realize I was using (x64) jre7 instead of (x86). I just had to download the correct one and add it to the JRE System library. Now everything runs perfectly.
I have made a simple java task to make query to Ms sql DB on windows, using jdbc library.
The program runs perfectly on my eclipse. I want to use it as an exe file (so I can send it to friend so he can use that as well).
I made a jar (using the export option on eclipse) so he can execute it as an exe file on windows. The problem is when he runs the jar file on windows for some reason the results of the query are empty. I am not sure what exactly is the problem.
It's not on localhost. This is how I connect -
String connectionUrl = "jdbc:sqlserver://**.***.***.***;" + "databaseName=&&&&&&&&;user=&&&&&&&&&&&;password=$$$$$$$$";
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
con = DriverManager.getConnection(connectionUrl);
This is the error I get - not sure how to handle it:
java.lang.UnsupportedOperationException: Java Runtime Environment (JRE) version 1.8 is not supported by this driver. Use the sqljdbc4.jar class library, which provides support for JDBC 4.0
I have sqljdbc4.jar and sqljdbc4.jar files on that folder.
Any thoughts?
Thanks!
It sounds like you need to modify your program so that it captures and prints out all runtime errors and warnings.
It also sounds like you want to add a "check health" feature to verify:
the program runs on your friend's PC,
the program connects to the MSSQL server,
the expected database is found on the server, and
the expected data exists in the database.
==================================================
ADDENDUM:
Thank you for updating your post and sharing the real problem:
This is the error I get - not sure how to handle it:
java.lang.UnsupportedOperationException: Java Runtime Environment
(JRE) version 1.8 is not supported by this driver. Use the
sqljdbc4.jar class library, which provides support for JDBC 4.0
It sounds like you compiled on an older version of Java (that's fine), with an older MSSQL/JDBC driver (that's fine, too) ...
... but your friend has a NEW JRE 1.8 which won't work with the new driver.
TWO SOLUTIONS:
Have your friend uninstall his JRE and then do a clean install of your Java version. For example, you can find older JRE 1.7 here:
http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html
Update your MSSQL driver to a current version (sqljdbc 4.2 is a good choice), verify that it works for you, then have your friend install the same MSSQL driver. You can download it here:
https://msdn.microsoft.com/en-us/library/mt484311%28v=sql.110%29.aspx
PS:
A third option - perhaps best - is for both of you to install the same version of Java and the same version of the MSSQL JDBC driver.
PPS: In the future, if you have an error message, please copy/paste it verbatim in your original post. A good error message is very often enough to resolve the problem immediately.
I'm running OpenGTS on a Windows 2012 server with Tomcat 7 and Java 1.7. I'd like to use SQL Server as I already have this installed. The specification was very clear on how to update the common.conf to point to the proper sql server database. However, when I run checkinstall.bat, (or any other DB tool for OpenGTS) I get an exception:
SEVERE: Java Runtime Environment (JRE) version 1.7 is not supported by this driver. Use the sqljdbc4.jar class library, which provides support for JDBC 4.0.
Exception in thread "main" java.lang.UnsupportedOperationException: Java Runtime Environment (JRE) version 1.7 is not supported by this driver. Use the sqljdbc4.jar class library, which provides support for JDBC 4.0.
at com.microsoft.sqlserver.jdbc.SQLServerConnection.<init>(SQLServerConnection.java:304)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1011)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.opengts.dbtools.DBConnection.getConnection(DBConnection.java:659)
at org.opengts.dbtools.DBConnection.createStatement(DBConnection.java:769)
at org.opengts.dbtools.DBConnection._execute(DBConnection.java:856)
at org.opengts.dbtools.DBConnection.execute(DBConnection.java:811)
at org.opengts.dbtools.DBConnection.execute(DBConnection.java:793)
at org.opengts.dbtools.DBFactory.tableExists(DBFactory.java:1648)
at org.opengts.tools.CheckInstall.main(CheckInstall.java:2100)
I'm pretty sure I've REMOVED or RENAMED sqljdbc.jar (perhaps renaming is not enough) in folders containing included jar files. I don't see any config file specifying this. I'm not a Java developer usually, but I feel there should be a simple thing I can do to "use" the sqljdbc4.jar that I have. I just don't know what that simple thing is... Any help would be appreciated!
It would certainly help if the SEVERE warning above which says "this" driver is not supported by JRE 1.7 would be perhaps more specific and let me know what driver "this" is...
Arg. There are too many JRE's on this machine! I found I had renamed the file in another JRE folder in lib\ext, so I removed that sqljdbc.jar file entirely. Now it is gone. Now the program works.
I'm running a Java application on a Linux server that uses Tibco RV and I get the following error:
TibrvException[error=901,message=Library not found: tibrvj]
What is causing this problem?
I have already added lib path containing *.so into LD_LIBRARY_PATH but still the same result.
UPDATE:
Currently, I have <MyApp>/libs/tibrvj.jar added into classpath. The tibrvj.jar was copied from Windows environment to the Linux box where I'm running my application. I removed this from the classpath and added another reference <TibcoDirectory>/libs/tibrvj.jar and it FIXED the problem. They have different sizes with the previous file and there's probably a difference between the one copied from Windows and the one currently in the Linux box. Can someone explain why is this so?
I had the same problem, and I fixed it doing the following:
File tibrvj.jar is present in the classpath of my application
File tibrvj.dll is present via java library path. This file is usually located at bin directory in Tibco Rendezvous home directory (e.g. C:/tibco/tibrv/8.2/bin)
The installed java version is compatible with the installed tibco version.
My environment is:
Windows 7, 64bits
Tibco Rendezvous 8.2, 64bits
JDK 1.6u29, 64bits
Before, I had installed a JDK 1.6u17, for a i586 processor and when I tried to load the library using:
System.loadLibrary("tibrvj");
I got this error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\TIBCO\tibrv\8.2\bin\tibrvj.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform
It gave me the clue to instal the correct java version.
Have you loaded the library using System.loadLibrary("tibrvj")? Have you added it to java.library.path?
Use :
java -Djava.library.path=/opt/tibco/tibrv/lib -cp {}.jar
LD_LIBRARY_PATH=/opt/tibco/tibrv/lib export LD_LIBRARY_PATH
Then **System.loadLibrary("tibrvj");**
The answers by rchavarria and DaveHowes helped, but for me the problem was that my IDE was overriding the PATH variable (and hence java.library.path) when running my project.
Removing this override made it work, as outside the IDE tibrv was already on the PATH.
Are you using Wrappers?
Do you have java.library.path set in your wrapper.conf?
I had java.library.path set in wrapper.conf, correct this value fixed the issue for me.
When using ANT to build my Java application I keep getting this error. I have tried multiple times to use SQLJDBC.JAR and SQLJDBC4.JAR but continually receive this error message. I am completely stumpped why this error is received even after upgrading to sqljdbc4.jar.
[javadoc] java.lang.UnsupportedOperationException:
Java Runtime Environment (JRE) version 1.6 is not supported by this driver.
Use the sqljdbc4.jar class library, which provides support for JDBC 4.0.
Refer to this link:
http://msdn.microsoft.com/en-us/library/ms378526.aspx
"sqljdbc4.jar class library requires a Java Runtime Environment (JRE) of version 6.0 or later."
So if you aren't using a JDK 1.6 or later when compiling, you will get an error when using sqljdbc4.jar.
If you are using JDK 1.5 or earlier, then you need to be using the sqljdbc.jar, which you can get from here.
Also, one tip with ANT is that you can use "ant -verbose" to help determine which libaries it's finding on the classpath to make sure it's using the sqljdbc JAR you expect. Also, make sure to confirm which version of the JDK you are compiling with. You can set the JAVA_HOME environment variable to point to a different JDK to compile with.