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.
Related
I'm having some issues when I try to run my program. it appears an error:
java.lang.Exception: 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
And I already add the library in my program, using the proper jre enviroment, but it keeps sending this error when they connect to my database. I tried every solution in stackoverflow for this issue and didn't work.
I verify that is the right sqljdbc4 too, I don't know what else to do.
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'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 have a web Application and i need to upgrade java jre version from 6 to 7 .I am using Eclipse as IDE.I tried to update the Jre from eclipse .I have even updated the JAVA_HOME environment variable but i am getting following error
C:\Program Files\Java\jdk1.7.0_55\jre..\lib\tools.jar
Please ensure you are using JDK 1.4 or above and
not a JRE (the com.sun.tools.javac.Main class is required).
In most cases you can change the location of your Java
installation by setting the JAVA_HOME environment variable.
Thanks
Download java hereand install it as a common application.
Then in Eclipse use Window->Prefrences->Java->Installed JREs
#Roman Bondar I guesss OP wanted to know more than just the setting.
Basically, JREs are meant to be downwards compatible, so that you are able to execute java classes compiled with version 6 with a runtime from java 7.
But as always, there may be special cases when things have to be changed, e.g. container or libraries. I remember a case back when I migrated to java 6 that it required a special version of JBoss.
Check out this Oracle blog as a starting point.
My Java applet only supports 1.4 java run time(1). I am having one machine on which both Java 1.4 and 1.6 environment is installed. Is there some setting available by which I can make sure my applet will always use Java 1.4 run time when it runs?
We are using key event class private data array bData with the help of Java reflection. The data which is there in this array JDK 1.4 and 1.6 is different in both the version.
A Java application compiled with JDK 1.4 will run on JDK 1.6.
You can compile a Java application with JDK 1.6, but compatible with JDK 1.4 by configuring the 'source level'.
Although you can choose your default JDK to be safe, but it depends on your operating system. If you are on Linux, you can choose between available Java versions using pdate-alternatives --config java command (which will modify some symlinks in the hindsight).
On Windows 7:
Control Panel -> Programs -> Java
Select 'Java' tab, and View the Java Runtime Environment settings.
Ensure that your Java 1.4 entry is selected.
There's a way to force a specific installed version to run, but if one Java plugin replaces the other there might be an issue with this. See linked question for further details.
Force Internet Explorer to use a specific Java Runtime Environment install?
Are there any issues with running the 1.4 code on 1.6? If not, you should be fine. Just avoid using anything in the classpath that changed significantly between these versions. Otherwise, look [here][1]. The codebase download thing is interesting, since it lets you download a different classpath. So, regardless of the JRE version, you could force the download of a 1.4 JRE classpath, which should ensure full compatability.
Edit: found an updated guide to using previous classpaths with newer Java versions in applets, which actually seems to work:
http://download.oracle.com/javase/tutorial/deployment/applet/deployingApplet.html
Edit 2: I actually have it working, but it appears to need to download JRE 1.4 and install it, but then it will run the applet with it automatically. However, this might be suitable for your needs.
http://www.2shared.com/file/bl3Rua2e/applet.html -- extract the archive, and then run index.html inside this. All source code is included.