At times, users have reported of runtime exceptions while running a simulation that uses PRoPHET. The error signature looks like the following.
-Djava.util.Arrays.useLegacyMergeSort=true
Exception in thread "main" java.lang. IllegalArgumentException: Comparison method violates its general contract!
at java.util.TimSort.mergeHi( Unknown Source)
at java.util.TimSort.mergeAt( Unknown Source)
at java.util.TimSort. mergeCollapse(Unknown Source)
at java.util.TimSort.sort(Unknown Source)
at java.util.Arrays.sort(Unknown Source)
at java.util.ArrayList.sort( Unknown Source)
at java.util.Collections.sort( Unknown Source)
It may be noted that the default sorting algorithm has changed since Java 7 — rather than Merge sort, Tim sort is now used by default. However, it seems like it is possible to override the default sorting algorithm in Java using the following argument to the JVM.
-Djava.util.Arrays.useLegacyMergeSort=true
The execution command in the one.sh (or one.bat) file should be updated with the above argument to something like this:
java -Xmx512M -Djava.util.Arrays.useLegacyMergeSort=true -cp .:lib/ECLA.jar:lib/DTNConsoleConnection.jar core.DTNSim $*
I, however, do not have a Java 7 installation, and therefore, could not test it. Users facing the aforementioned runtime exception can try it out and share their experiences here.
java -Xmx512M -Djava.util.Arrays.useLegacyMergeSort=true -cp .:lib/ECLA.jar:lib/DTNConsoleConnection.jar core.DTNSim $*
I, however, do not have a Java 7 installation, and therefore, could not test it. Users facing the aforementioned runtime exception can try it out and share their experiences here.
I just tried it, it works indeed, Thanks a lot ��
ReplyDeleteDo you tell please...how to update this argument in one.bat file.....??? I've the same problem....
Deletetry
Delete"java -Djava.util.Arrays.useLegacyMergeSort=true -Xmx512M -cp .;lib/ECLA.jar;lib/DTNConsoleConnection.jar core.DTNSim %*" That works for me.
And I recommend that you should downgrade to a version earlier than Java 6 and try it.
DeleteAs an aside, if you are simulating using Eclipse, it will be solved by setting "Execution environment" value to Java6 or earlier one from the property of JRE system library in the project think.
I have tested it in latest version of java like shown below and it works
ReplyDeletejava -Xmx512M -Djava.util.Arrays.useLegacyMergeSort=true -cp .;lib/DTNConsoleConnection.jar core.DTNSim %*
Thanks a lot sir for the tutorial