How to set property "java.util.Arrays.useLegacyMergeSort" in jnlp-file?

Hi,
I have a problem in a web start application with java 7 and the new sort behavior (exception: comparison method violates its general contract).
So I like to go back to previous behavior and tried to put the new java 7 system property "java.util.Arrays.useLegacyMergeSort" in the generated jnlp-File:
<property name="java.util.Arrays.useLegacyMergeSort" value="true"/>.
Now I can read the property value in java code with System.getProperty("java.util.Arrays.useLegacyMergeSort"), and guess the property was successful set, but the exception still appears?!
The system property works with command line "javaws -J-Djava.util.Arrays.useLegacyMergeSort=true file.jnlp", but not via doubleclick on the jnlp-file or url and browser.
Any ideas?
Cheers,
Dan

Only "trusted" set of properties can be set in the JNLP file by unsigned applications.
List of properties is revised from time to time but it usually takes time for new properties to be added to it (if there is strong demand for it as every property should undergo security audit).
You can specify arbitrary property if you sign your application and JNLP file.

Similar Messages

  • Java.util.Arrays.sort for Vector

    I used the java.util.Arrays.sort to sort an array based on the method below.
                  java.util.Arrays.sort(array, 0, total, new ComparatorX());
               repaint();
                class ComparatorX implements java.util.Comparator
              public int compare( Object p1, Object p2){
                   int x1=((Point)p1).x;
                   int x2=((Point)p2).x;
                   if(x1>x2)
                                return 1;
                   if(x1>x2)
                                return -1;
                   return 0;
         }I've since changed the array to a vector. Is there anyway I can keep the comparator. Or how can I sort the vector based on the above method.

    BTW: Don't know if it's just a typing mistake, but your code contains an error:
    class ComparatorX implements java.util.Comparator     {
       public int compare( Object p1, Object p2) {
          int x1=((Point)p1).x;
          int x2=((Point)p2).x;
          if (x1>x2) {
             return 1;
          if (x1>x2) {  // Should be: if (x2 > x1) ...
             return -1;
          return 0;

  • How can I define "java.util.ResourceBundle" in my Code ?

    Dear Mr. MLRon,
    Thanks to you for your replying to me.
    How can I define "java.util.ResourceBundle" in my Code ? To more understanding about my problem I can say that the Persian Font is Like as Arabic, but the Java can not Recognize it. please tell me how can I add "java.util.ResourceBundle" to my code and what should I do then?
    Thank you in advance,
    Tantan.

    Please stop starting new threads for this. Please reply in the original thread!
    http://forum.java.sun.com/thread.jspa?threadID=627917

  • Using java.util.Arrays.binarySearch

    Hi,
    I tried the following code
    import java.util.Arrays ;
    class SecondTry {   
    public static void main(java.lang.String args[]) {
    int xyz[] = new int[10];
    xyz[0] = 5;
    xyz[1] = 6;
    xyz[2] = 1;
    Arrays.sort(xyz);
    System.out.println(Arrays.binarySearch(xyz,5));
    i expected to see a result of 1. But i get a 8.
    I am sure i must be doing something wrong. But not able to figure out what exactly is wrong. Could somebody help?
    TIA,
    Babu

    hi there,
    .The output was 8 because u have declared the array size to be 10,so the values which are not assigned would be assigned to zero,so if you change the array size to 3,u would get the desired output :)
    cheers
    class SecondTry {
    public static void main(java.lang.String args[]) {
    int xyz[] = new int[3]; //change to three
    xyz[0] = 5;
    xyz[1] = 6;
    xyz[2] = 1;
    Arrays.sort(xyz);
    System.out.println(Arrays.binarySearch(xyz,5));

  • Java.util.Array

    Exception in thread "main" java.lang.ClassCastException: Card
    at java.util.Arrays.mergeSort(Arrays.java:1044)
    at java.util.Arrays.sort(Arrays.java:997)
    at CardPlayer.sortHand(CardPlayer.java:91)
    at Game.main(Game.java:75)
    i get this error message after I call a sort method using the java.util.Array
    does anyone know why, or do u need more code?
    thanks

    The Card object needs to implement the Comparable interface if an array of them is to be sorted. The ClassCastException occurs when the sorting code attempts to assign a Card Object to a Comparable variable. The API documentation refers to this problem like this:
    Throws:
    ClassCastException - if the array contains elements that are not mutually comparable (for example, strings and integers).

  • Trouble extending java.util.Arrays

    I have written some utility functions for dealing with arrays and I would like to bundle them into a class along with java's built-in array functions (java.util.Arrays). To do this, I tried to extends the class java.util.Arrays like this:
    public class ArrayUtils extends java.util.Arrays
    /* some static methods */
    When I try to compile this with javac (even with no class body between the braces), I get an error "error:Cannot find constructor "Arrays" with matching parameters [JLS 15.12]". Does anyone know what's going on here? Why is the compiler looking for a constructor? And why can't it find one? I would very much appreciate your insight. Thanks. Eli

    Does anyone know what's
    going on here? Why is the compiler looking for a
    constructor? And why can't it find one?Conceputually....
    Inheritance exists to allow one to inherit from an object. In java objects can be created by using a class. However classes in java do not have to be objects. And you are trying to inherit from something that is not an object.
    One of the other uses for class in java is to group a number of convienent functions together. (Grouped functions do NOT represent a class.) That is what java.util.Arrays is.
    Technically....
    The class java.util.Arrays has a private constructor which means you can't derive anything from it.

  • Private static ArrayList within java.util.Arrays

    I was recently reviewing the code in java.util.Arrays (class version 1.45 - Java version 1.4.1). Beginning on line 2289 is a private static class named ArrayList. I'm completely baffled as to why the author created this slimmed-down private class (which would be, incidentally, returned by the Arrays.asList(Object[] a) method) rather than use the public class java.util.ArrayList. Can anyone offer an explanation?
    Thanks,
    John

    from JDK JAVADoc:
    asList
    public static List asList(Object[] a)
    Returns a fixed-size list backed by the specified array. (Changes to the returned list "write through" to the array.) This method acts as bridge between array-based and collection-based APIs, in combination with Collection.toArray. The returned list is serializable.
    So the private ArrayList extends java.util.ArrayList, and any changes made this list does not affect the internal Object[].... in other words can not be changed.

  • How to disable access to internet completely in the jnlp file

    Hi All,
    Can someone help me in figuring out how to disable access to internet completely in the jnlp file.
    To be specific with the scenario if the client does not have the JRE installed, i would like to have it downloaded from the server where application runs instead of going to java.sun.com website which needs internet access.
    How can we configure it in such a way that it does not go to internet at all.
    Here is the snapshot of my jnlp file
    <j2se version="1.5.0+" href="http://java.sun.com/products/autodl/j2se" initial-heap-size="128m" max-heap-size="128m"/>
    I tried with the following and still unsuccessful.
    <j2se version="1.5.0+" initial-heap-size="128m" max-heap-size="128m"/>
    Could not find any useful information in the documentation.

    see post from Mike at:
    http://forum.java.sun.com/thread.jspa?threadID=704112&messageID=4082098#4082098
    for how to set up your own autodownload of jre from within your internet.
    /Andy

  • How can i compare:  java.util.Date oracle.jbo.domain.Date?

    I have made a ViewObject wich contains a date column.
    I want to check if this date is smaller/greater than sysdate:
    i get following error:
    Error(45,24): method <(java.util.Date, oracle.jbo.domain.Date) not found in class Class4
    code:
    SimpleTimeZone pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids[0]);
    // set up rules for daylight savings time
    pdt.setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
    pdt.setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
    // create a GregorianCalendar with the Pacific Daylight time zone
    // and the current date and time
    Calendar calendar = new GregorianCalendar(pdt);
    Date trialTime = new Date();
    calendar.setTime(trialTime);
    (VO_ULNRow)singleRow = null;
    while(vo.hasNext()){                                             // ViewObject vo;
    singleRow = (VO_ULNRow)vo.next();
    if(calendar.getTime() < singleRow.getEO_ULN_BORROWFROM()); //singleRow returns oracle.jbo.domain.Date
    etcetera
    how can i compare those 2?

    Hi,
    oracle.jbo.domain.Date has two methods which suit your needs
    longValue() which returns a long (though I'm not sure if returns a long comparable to the long returned by java.util.Date)
    and dateValue() which returns a java.util.Date
    I hope it helps,
    Giovanni

  • Java.util.Arrays; (method sort( ) )

    1) How to change a direction of sorting (on increase / on decrease)?
    2) Whether exists in java 2 something similar for sorting Strings ?

    1) How to change a direction of sorting (on increase
    / on decrease)?[url http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collections.html#reverseOrder()]http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collections.html#reverseOrder()
    2) Whether exists in java 2 something similar for
    sorting Strings ?Arrays.sort and Collections.sort will both sort the array or list as long as the type implements Comparable (or you supply a separate Comparator). Since String implements Comparable, those sort methods will sort the array or list of strings.
    Making Java Objects Comparable
    http://java.sun.com/docs/books/tutorial/collections/interfaces/order.html
    http://www.javaworld.com/javaworld/jw-12-2002/jw-1227-sort.html

  • How to populate a java script array from a bean.

    Hi all,
    I have a list "mdfProductNames" which is further comprising of two fields "subGroup" and "mdfProductName"
    The list is coming is a part of the form bean.(struts framework)
    Now i want to have the values of these two fields in two different java script arrays.
    i.e. Array x -> mdfProductName
    and Array y -> subGroup
    can someone give me any idea as to how to do this ?
    Thanks
    Edited by: Ramit on 17 Jul, 2008 9:53 AM

    hi,
    assuming u use jstl, u need to create javascript variable during html generation out of the values got from struts form bean. it could look like this:
    ------ .jsp file ----
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
    <script type="text/javascript">
    var X = [];
    var Y = [];
    <c:forEach items="${formBeanName.mdfProductNames}" var="grpProdName">
    X.push( '${grpProdName.mdfProductName}' );
    Y.push( '${grpProdName.subGroup}' );
    </c:forEach>
    // here u already have the two arrays filled up with data
    </script>
    ------- end of .jsp file
    "formBeanName" is a name of a formbean u use to store the list of your beans
    rafal baton zaczynski
    http://baton.pop.e-wro.pl - tips and codes
    http://www.belysio.com - free mobile localization soft

  • Error: java.lang.ClassCastException: java.util.Arrays$ArrayList

    Hi,
    How to solve this error?
    I get the error at this line of code in my program.
    java.util.ArrayList list= (java.util.ArrayList)obj;
    Please help how to solve this problem.
    Thanks,
    cmbl

    cmbl wrote:
    How to solve this error?
    I get the error at this line of code in my program.
    java.util.ArrayList list= (java.util.ArrayList)obj; Don't do this cast.
    Why are you doing this cast anyway? I think you need to show a small bit of compilable code (or almost compilable except perhaps for this error) and some more explanation.

  • AsList(java.lang.Object[]) in java.util.Arrays cannot be applied to (int[])

    hi all,
    i'm getting the above error msg when trying to compile a simple array prog...
    while at it, is there another simple way to print the contents
    of an array to the console in a single statement except using the asList method??? .. like :
    int[] myArray = {1,2,3,4};
    System.out.println(myArray);
    ==================================
    here's the code for my program :-
    tks in advance.
    import java.util.*;
    public class ListArray {
    public static void main(String args[]) {
         int[] anArray = {2,7,5,8,3};
         for (int i = 0; i < anArray.length; i++) {
         System.out.println("Element No : " + (i+1) + " = " + anArray);
         System.out.println("All the Elements : " + Arrays.asList(anArray));

    Funnily enough, thats because int[] is not an array of Objects.
    You can make your listing method work by writing this instead:
    for (int index = 0; index < anArray.length; index++) {
      System.out.println("Element No: " + (index + 1) + " = " + anArray[index]);
    }

  • Win32: how to set default java

    Hello
    I have several jre's installed and like a good do-bee have set the environment variable to the one I want as "default" Of course this does not work in Windows. If I run a command-ine program it uses the one set in the registry and blissfully ignores the environment variable.
    I know that the multiple installs of jre's each maintain their own registry entries, but where is the damn tool to REALLY set the one for default. Again I have set java_home & java-home to what I want and it is NOT what is being used. How do I get that consistent or at least get commandline win32 to use the one I want? tia.

    And how do you 'run' them?
    If you use 'java' from a console window then it searches via the PATH env var. And that has nothing to do with the registry.

  • How to set the Java VM parameters in Ant ?

    Hi All,
    Am trying to set the Java VM parameter "-Djava.library.path=C:\MA\bin" in Ant task.
    I used tag <java jvmargs="">
    but it dint seems to be working.
    Any help on this would be appriciated.
    thanks in advance,
    Loginform.

    Thanks for your response,
    When i tried with the above option it doesnt seems to load the .dll file in the path.
    Could you pls suggest how to set the .dll in classpath in Ant
    It would be greathelp.
    Thanks in advance,
    loginform.

Maybe you are looking for