Wednesday, November 28, 2012

JDeveloper 11gR2 and Java 7

Hello all. For an ADF Essentials application I'm working on I wanted to use the great set of new features introduced by Java 7, however JDeveloper 11gR2 (11.1.2.3) is not certified for JDK 7 so I had to look for help and found some tricks that let you use the new JDK.

This is what you need to do:
  1. Download and Install the new JDK. You can find the latest release using this link.
  2. Add the new JDK to JDeveloper's libraries: Tools -> Manage Libraries.
  3. Configure JDeveloper to run using the new JDK.
  4. Configure the Integrated Weblogic server to run using the new JDK.

The first step is pretty simple. Just go to that location, download the latest release of Java 7 and install it on your machine. In my case, I didn't have to create any environment variable for the JAVA_HOME or PATH, but your case may be different.

Open JDeveloper and go to the menu Tools and then open Manage Libraries:



The Manage Libraries dialog appears, select the title Java SE Definitions and then click on the button New... 



The Create Java SE dialog appears. For me, the Browse... button didn't work when trying to get in the Program Files directory, so I opened Windows Explorer and went to new JDK installation directory (for me it was: C:\Program Files\java\jdk1.7.0_09) then I copied the path from Windows Explorer and pasted it on the Java SE Executable inputText. I also added  \bin\java.exe





Notice that after you complete the path to the Java SE executable (\bin\java.exe), Jdeveloper will load the rest of the information. Hit the OK button to finish.

Now, JDeveloper comes with its own JDK and we need to change it for the new one you just installed. Close JDeveloper, open Windows Explorer and go to {ORACLE_HOME}\jdeveloper\jdev\bin where {ORACLE_HOME} is the directory you used when installing JDeveloper. There you will find a file called jdev.conf open it with a text editor and look for the entry SetJavaHome on line 31 (line numbers may differ in other versions of Jdeveloper), comment it and create a new SetJavaHome entry below that one, but this time use the new JDK installation folder:




What we just did tells JDeveloper to start with the new JDK. Now we need to configure the Integrated Weblogic server so it starts with the new JDK as well.

We need to find the value of the -Dide.pref.dir.base entry as described here:
http://www.java-n-me.com/2012/11/jdeveloper-11gr2-wont-start.html

In my case the value of the entry is: C:\Users\{MY_USER}\AppData\Roaming, where {MY_USER} is my user name, you may need to enable the "show hidden files" property of the Windows Explorer in order to be able to locate that directory. There,  look for the JDeveloper\system11.x.x.x.. directory where the x's are numbers. Open DefaultDomain\bin directory and edit setDomainEnv.cmd using a text editor:



Comment the line 45 and below that line set the SUN_JAVA_HOME property to point to the new JDK. Repeat the same procedure for the JAVA_HOME  property found at line 55 (line numbers may differ in other versions of Jdeveloper):



That's it, now JDeveloper and its Integrated Weblogic Server will use the new JDK. Open JDeveloper and go to Help->About->Version and you will notice that it is using the new JDK:



As I didn't want to keep using the old JDK I removed it from the Tools->Manage Libraries menu option so my new JDK become the Default JDK and all my new projects will be using Java 7:



I hope this workaround works for you as it did for me.

see ya!


References:

Using WebLogic Server with JDK 7. Oracle [online].
Available on Internet: http://docs.oracle.com/cd/E23943_01/doc.1111/e14142/jdk7.htm
[accessed on Novemeber 25th 2012].

Nick Aiva's blog! [online].
Available on Internet: http://nickaiva.blogspot.com/2011/04/jdeveloper-11g-setting-up-newest-java.html
[accessed on Novemeber 25th 2012].

9 comments:

  1. It’s really a nice and helpful types of information. I’m glad to see that you shared this helpful information with us.

    ReplyDelete
  2. It’s really a nice and helpful types of information. I’m glad to see that you shared this helpful information with us.

    ReplyDelete
  3. Alexis can i integrate jdk 7 with jDeveloper 11g R1

    ReplyDelete
    Replies
    1. Hi. Both, JDeveloper 11gR1 and R2 don't have jdk 7 in their certification matrix. However I've been working with R2 and jdk 7 for 5 months already and have found that it works OK. I do have found one bug, though, related to task flow routers (Bug 14107077 : PROPERTY FOR CASE OF ROUTER NOT SAVED USING JDK 1.7).
      So, to answer your question, Yes, you may run JDeveloper 11gR1 with jdk 7, but it's up to you, Oracle does not recommend it as you may find a bug.

      Delete
  4. You sir, are a legend! Couldn't understand why my web service deploy would not succeed and it was because of different Java versions on Jdev & WLS. All is well again now, thank you so much!

    ReplyDelete
  5. Alexis

    Thank you so much, it was very helpful. Good Luck!!!

    ReplyDelete