[ 
https://issues.apache.org/jira/browse/DERBY-4263?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kristian Waagan updated DERBY-4263:
-----------------------------------

    Attachment: derby-4263-1a-jdk_detection_by_jars.diff

I have written an alternative algorithm for detecting JDKs. It is using the 
same basics as the existing one, but instead of looking at the directory name 
it looks for specific JAR files.
The new code has been tested lightly on Solaris, Linux and Windows, and has 
worked with JDKs from Sun, IBM and Oracle/BEA. It doesn't work with Apache 
Harmony, and I haven't looked at IcedTea.
The new algorithm will first try to pick the newest JDK from the same vendor as 
the running JDK, and if that fails it will pick the newest JDK from any vendor.
If the new algorithm doesn't find the required JDKs, the old algorithm will be 
attempted.
Note that I changed the property setter to go ahead also if the JDK vendor 
isn't recognized. I don't really see a reason for aborting. Does anyone 
disagree?
The PropertySetter should behave as before for the Mac, but testing wouldn't 
hurt!

There are many possible combinations, so it would be nice if people could take 
the new code for a test spin!


Here's the output from running "ant -DprintCompilerProperties" (btw, using less 
gives you more ;) ) on a system of mine:

printCompilerProperties:
     [echo] Before setting properties:  compilerPropsAlreadySet = 
${compilerPropsAlreadySet}
     [echo] Before setting properties:  compilerLevel16 = 1.5
     [echo] Before setting properties:  jsr169compile.classpath = 
${jsr169compile.classpath}
     [echo] Before setting properties:  j14lib = ${j14lib}
     [echo] Before setting properties:  java14compile.classpath = 
${java14compile.classpath}
     [echo] Before setting properties:  j15lib = ${j15lib}
     [echo] Before setting properties:  java15compile.classpath = 
${java15compile.classpath}
     [echo] Before setting properties:  j16lib = ${j16lib}
     [echo] Before setting properties:  java16compile.classpath = 
${java16compile.classpath}
[setJdkProperties] 
[setJdkProperties] PropertySetter environment =
[setJdkProperties] 
[setJdkProperties] java.vendor = Sun Microsystems Inc.
[setJdkProperties] java.home = /tmp/myjdk/jre
[setJdkProperties] java.version = 1.5.0_16
[setJdkProperties] os.name = SunOS
[setJdkProperties] j14lib = null
[setJdkProperties] j15lib = null
[setJdkProperties] j16lib = null
[setJdkProperties] jdkSearchPath = /tmp, /usr/jdk
[setJdkProperties] 
[setJdkProperties] found JDK: vendor=Sun Microsystems, Inc., specVersion=1.5, 
implVersion=1.5.0_16, path=/tmp/myjdk
[setJdkProperties] found JDK: vendor=Sun Microsystems, Inc., specVersion=1.6, 
implVersion=1.6.0_11, path=/usr/jdk/jdk1.6.0_11
[setJdkProperties] found JDK: vendor=Sun Microsystems, Inc., specVersion=1.5, 
implVersion=1.5.0_17, path=/usr/jdk/jdk1.5.0_17
[setJdkProperties] found JDK: vendor=Sun Microsystems, Inc., specVersion=1.6, 
implVersion=1.6.0_13, path=/usr/jdk/latest
[setJdkProperties] found JDK: vendor=Sun Microsystems, Inc., specVersion=1.4, 
implVersion=1.4.2_18, path=/usr/jdk/j2sdk1.4.2_18
[setJdkProperties] found JDK: vendor=Sun Microsystems, Inc., specVersion=1.6, 
implVersion=1.6.0_14, path=/usr/jdk/jdk1.6.0_14
[setJdkProperties] found JDK: vendor=Sun Microsystems, Inc., specVersion=1.6, 
implVersion=1.6.0_13, path=/usr/jdk/jdk1.6.0_13
[setJdkProperties] found JDK: vendor=Sun Microsystems, Inc., specVersion=1.5, 
implVersion=1.5.0_16, path=/usr/jdk/jdk1.5.0_16
[setJdkProperties] found JDK: vendor=Sun Microsystems, Inc., specVersion=1.6, 
implVersion=1.7.0-ea, path=/usr/jdk/jdk1.7.0
[setJdkProperties] found JDK: vendor=Sun Microsystems, Inc., specVersion=1.6, 
implVersion=1.6.0_14-ea, path=/usr/jdk/jdk1.6.0_14-ea
[setJdkProperties] Chosen JDK for specification version 1.4 (vendor Sun 
Microsystems Inc.): vendor=Sun Microsystems, Inc., specVersion=1.4, 
implVersion=1.4.2_18, path=/usr/jdk/j2sdk1.4.2_18
[setJdkProperties] Chosen JDK for specification version 1.5 (vendor Sun 
Microsystems Inc.): vendor=Sun Microsystems, Inc., specVersion=1.5, 
implVersion=1.5.0_17, path=/usr/jdk/jdk1.5.0_17
[setJdkProperties] Chosen JDK for specification version 1.6 (vendor Sun 
Microsystems Inc.): vendor=Sun Microsystems, Inc., specVersion=1.6, 
implVersion=1.6.0_14, path=/usr/jdk/jdk1.6.0_14
[setJdkProperties] Setting property java14compile.classpath to 
/usr/jdk/j2sdk1.4.2_18/jre/lib/charsets.jar:/usr/jdk/j2sdk1.4.2_18/jre/lib/jce.jar:/usr/jdk/j2sdk1.4.2_18/jre/lib/jsse.jar:/usr/jdk/j2sdk1.4.2_18/jre/lib/plugin.jar:/usr/jdk/j2sdk1.4.2_18/jre/lib/rt.jar:/usr/jdk/j2sdk1.4.2_18/jre/lib/sunrsasign.jar
[setJdkProperties] Setting property java15compile.classpath to 
/usr/jdk/jdk1.5.0_17/jre/lib/charsets.jar:/usr/jdk/jdk1.5.0_17/jre/lib/deploy.jar:/usr/jdk/jdk1.5.0_17/jre/lib/javaws.jar:/usr/jdk/jdk1.5.0_17/jre/lib/jce.jar:/usr/jdk/jdk1.5.0_17/jre/lib/jsse.jar:/usr/jdk/jdk1.5.0_17/jre/lib/plugin.jar:/usr/jdk/jdk1.5.0_17/jre/lib/rt.jar
[setJdkProperties] Setting property java16compile.classpath to 
/usr/jdk/jdk1.6.0_14/jre/lib/alt-rt.jar:/usr/jdk/jdk1.6.0_14/jre/lib/charsets.jar:/usr/jdk/jdk1.6.0_14/jre/lib/deploy.jar:/usr/jdk/jdk1.6.0_14/jre/lib/javaws.jar:/usr/jdk/jdk1.6.0_14/jre/lib/jce.jar:/usr/jdk/jdk1.6.0_14/jre/lib/jsse.jar:/usr/jdk/jdk1.6.0_14/jre/lib/management-agent.jar:/usr/jdk/jdk1.6.0_14/jre/lib/plugin.jar:/usr/jdk/jdk1.6.0_14/jre/lib/resources.jar:/usr/jdk/jdk1.6.0_14/jre/lib/rt.jar

printCompilerProperties:
     [echo] After setting properties:  compilerPropsAlreadySet = true
     [echo] After setting properties:  compilerLevel16 = 1.5
     [echo] After setting properties:  jsr169compile.classpath = 
/export/home/kw160128/derby/wdir/trunk-merge-basin/classes/stubs/jsr169:/usr/jdk/j2sdk1.4.2_18/jre/lib/charsets.jar:/usr/jdk/j2sdk1.4.2_18/jre/lib/jce.jar:/usr/jdk/j2sdk1.4.2_18/jre/lib/jsse.jar:/usr/jdk/j2sdk1.4.2_18/jre/lib/plugin.jar:/usr/jdk/j2sdk1.4.2_18/jre/lib/rt.jar:/usr/jdk/j2sdk1.4.2_18/jre/lib/sunrsasign.jar
     [echo] After setting properties:  j14lib = ${j14lib}
     [echo] After setting properties:  java14compile.classpath = 
/usr/jdk/j2sdk1.4.2_18/jre/lib/charsets.jar:/usr/jdk/j2sdk1.4.2_18/jre/lib/jce.jar:/usr/jdk/j2sdk1.4.2_18/jre/lib/jsse.jar:/usr/jdk/j2sdk1.4.2_18/jre/lib/plugin.jar:/usr/jdk/j2sdk1.4.2_18/jre/lib/rt.jar:/usr/jdk/j2sdk1.4.2_18/jre/lib/sunrsasign.jar
     [echo] After setting properties:  j15lib = ${j15lib}
     [echo] After setting properties:  java15compile.classpath = 
/usr/jdk/jdk1.5.0_17/jre/lib/charsets.jar:/usr/jdk/jdk1.5.0_17/jre/lib/deploy.jar:/usr/jdk/jdk1.5.0_17/jre/lib/javaws.jar:/usr/jdk/jdk1.5.0_17/jre/lib/jce.jar:/usr/jdk/jdk1.5.0_17/jre/lib/jsse.jar:/usr/jdk/jdk1.5.0_17/jre/lib/plugin.jar:/usr/jdk/jdk1.5.0_17/jre/lib/rt.jar
     [echo] After setting properties:  j16lib = ${jdk16}/jre/lib
     [echo] After setting properties:  java16compile.classpath = 
/usr/jdk/jdk1.6.0_14/jre/lib/alt-rt.jar:/usr/jdk/jdk1.6.0_14/jre/lib/charsets.jar:/usr/jdk/jdk1.6.0_14/jre/lib/deploy.jar:/usr/jdk/jdk1.6.0_14/jre/lib/javaws.jar:/usr/jdk/jdk1.6.0_14/jre/lib/jce.jar:/usr/jdk/jdk1.6.0_14/jre/lib/jsse.jar:/usr/jdk/jdk1.6.0_14/jre/lib/management-agent.jar:/usr/jdk/jdk1.6.0_14/jre/lib/plugin.jar:/usr/jdk/jdk1.6.0_14/jre/lib/resources.jar:/usr/jdk/jdk1.6.0_14/jre/lib/rt.jar



> PropertySetter isn't able to recognize JDK without version number in path
> -------------------------------------------------------------------------
>
>                 Key: DERBY-4263
>                 URL: https://issues.apache.org/jira/browse/DERBY-4263
>             Project: Derby
>          Issue Type: Bug
>          Components: Build tools
>    Affects Versions: 10.6.0.0
>            Reporter: Knut Anders Hatlen
>            Priority: Minor
>         Attachments: derby-4263-1a-jdk_detection_by_jars.diff
>
>
> With empty ant.properties and JDK 6 installed in /tmp/jdk as the only JDK on 
> the system, PropertySetter complains that it's not able to set 
> java16compile.classpath:
> ,----
> | [setJdkProperties] 
> | [setJdkProperties] PropertySetter environment =
> | [setJdkProperties] 
> | [setJdkProperties] java.vendor = Sun Microsystems Inc.
> | [setJdkProperties] java.home = /tmp/jdk/jre
> | [setJdkProperties] java.version = 1.6.0_13
> | [setJdkProperties] os.name = SunOS
> | [setJdkProperties] j14lib = null
> | [setJdkProperties] j15lib = null
> | [setJdkProperties] j16lib = null
> | [setJdkProperties] 
> | 
> | BUILD FAILED
> | /code/derby/trunk0/build.xml:203: Don't know how to set 
> java15compile.classpath, java16compile.classpath using this environment:
> | 
> | java.vendor = Sun Microsystems Inc.
> | java.home = /tmp/jdk/jre
> | java.version = 1.6.0_13
> | os.name = SunOS
> | j14lib = null
> | j15lib = null
> | j16lib = null
> `----
> Since it is able to detect both that the version of the default JDK is 
> 1.6.0_13 and where it is installed, setting java16compile.classpath should be 
> trivial.
> If the name of the JDK directory is changed from /tmp/jdk to /tmp/jdk1.6.0, 
> Derby is built successfully.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to