JavaXT

JDK Compatibility

The current implementation of javaxt-core is designed for Java 1.6 but it will compile and run on Java 1.5. To support Java 1.5 I had to update 2 classes in the javaxt-core package.

java.io.File

The isExecutable method was incompatible with JDK 1.5 because no canExecute() method exists on java.io.File. I now check the Java version and use reflection to invoke the canExecute() for Java 1.6 and higher.

    public boolean isExecutable(){
        if (File!=null){


            //return File.canExecute(); //<--incompatable with JDK 1.5
           
            String[] arr = System.getProperty("java.version").split("\\.");
            if (Integer.valueOf(arr[0]).intValue()==1 && Integer.valueOf(arr[1]).intValue()<6) return false;
            else{
                try{
                    return (Boolean) File.getClass().getMethod("canExecute").invoke(File, null);
                }
                catch(Exception e){
                    return false;
                }
            }
           

        }
        else return false;
    }

java.io.ResultSet

The isOpen method was incompatible with JDK 1.5 because no isClosed() method exists on java.sql.ResultSet. Again, using reflection, I invoke the isClosed on Java 1.6 and higher.

    public boolean isOpen(){
        if (State!=0) {
           
            //return !rs.isClosed(); //<--incompatable with JDK 1.5
           
            String[] arr = System.getProperty("java.version").split("\\.");
            if (Integer.valueOf(arr[0]).intValue()==1 && Integer.valueOf(arr[1]).intValue()<6) return false;
            else{
                try{
                    return !((Boolean) rs.getClass().getMethod("isClosed").invoke(rs, null));
                }
                catch(Exception e){
                    return false;
                }
            }           
        }
        else return false;
    }