jdk1.6

Use fork-and-join in JDK6

 ̄綄美尐妖づ 提交于 2019-11-28 12:26:44
As I understand jdk7 has the support for fork-and-join, Can I use fork-and-join in JDK6 without upgraging to JDK7.0? Yup, see here - the package you want is jsr166y. 来源: https://stackoverflow.com/questions/8205874/use-fork-and-join-in-jdk6

HttpURLConnection implementation

扶醉桌前 提交于 2019-11-28 08:20:57
I have read that HttpURLConnection supports persistent connections, so that a connection can be reused for multiple requests. I tried it and the only way to send a second POST was by calling openConnection for a second time. Otherwise I got a IllegalStateException("Already connected"); I used the following: try{ URL url = new URL("http://someconection.com"); } catch(Exception e){} HttpURLConnection con = (HttpURLConnection) url.openConnection(); //set output, input etc //send POST //Receive response //Read whole response //close input stream con.disconnect();//have also tested commenting this

Why are we getting ClosedByInterruptException from FileChannel.map in Java 1.6?

让人想犯罪 __ 提交于 2019-11-28 00:46:02
A customer of ours complains that, sporadically, calls of ours to FileChannel.map fail with a ClosedByInterruptException . The Javadoc does not list this as a legitimate possibility. Does anyone know what might be going on here? Cause0: java.nio.channels.ClosedByInterruptException Cause0-StackTrace: at java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:184) at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:772) Channel operations are bound to the thread doing the operations. If this thread is interrupted, the stream / channel is closed due to IO

Why do two methods with signature (primitive, wrapper) and (primitive, primitive) cause the method call (wrapper, primitive) to be ambiguous?

我的未来我决定 提交于 2019-11-27 23:15:48
问题 It's just an exercise but I can't figure out the ambiguity: private static void flipFlop(String str, int i, Integer iRef) { System.out.println(str + "ciao"); } private static void flipFlop(String str, int i, int j) { System.out.println(str + "hello"); } public static void main(String[] args) { flipFlop("hello", new Integer(4), 2004); } It says: The method flipFlop(String, int, Integer) is ambiguous for the type Test I would have guessed that the second argument would have been unwrapped to

TimeZone.setDefault changes in JDK6

时光总嘲笑我的痴心妄想 提交于 2019-11-27 22:05:27
I just noticed that JDK 6 has a different approach to setting a default TimeZone than JDK5. Previously the new default would be stored in a thread-local variable. With JDK6 (I just reviewed 1.6.0.18) the implementation has changed, so that if the user can write to the "user.timezone" property, or if there is no SecurityManager installed, the timezone changes VM-wide! Otherwise a thread-local change occurs. Am I wrong? This seems to be quite a drastic change, and I couldn't find anything on the web about it. Here is the JDK6 code: private static boolean hasPermission() { boolean hasPermission =

Jboss Server Error:Server already running on localhost

岁酱吖の 提交于 2019-11-27 20:25:46
问题 I am working on web project where jboss application server is required. After configured the jboss server, I was running my application. It is showing error like:Server already running on local host.Web found a running server at URL //localhost:8080. 回答1: Works for me Open Command Prompt Type netstat -noa and hit Enter Check the "PID" of process that uses your port And type taskkill /PID "PID number" and hit Enter As @Mxsky stated: You may have to force the processus to quit with the /F

New features in JDK 1.6 and 1.7

◇◆丶佛笑我妖孽 提交于 2019-11-27 14:29:55
问题 I know JDK 1.5 pretty well. As we all know, besides new API (such as AtomicInteger, for example), there were major language changes such as providing support for generic, adding enum, prividing auto-boxing and auto-unboxing and so on. I want to find some resources that have preferably short description of new features in JDK 1.6 and 1.7 (for big new features I prefer to read complete explanations). As far changes of API only major changes is acceptable and short review of new one (if I recall

Most concise way to convert a Set<String> to a List<String>

最后都变了- 提交于 2019-11-27 09:20:21
问题 I am currently doing this: Set<String> setOfTopicAuthors = .... List<String> list = Arrays.asList( setOfTopicAuthors.toArray( new String[0] ) ); Can you beat this ? 回答1: List<String> list = new ArrayList<String>(listOfTopicAuthors); 回答2: List<String> l = new ArrayList<String>(listOfTopicAuthors); 回答3: Considering that we have Set<String> stringSet we can use following: Java 10 (Unmodifiable list) List<String> strList = stringSet.stream().collect(Collectors.toUnmodifiableList()); Java 8

UnsupportedClassVersionError: JVMCFRE003 bad major version in WebSphere AS 7

限于喜欢 提交于 2019-11-27 08:13:56
I am getting this error java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=map/CareMonths, offset=6 My Eclipse's Java compiler is set to 1.6 and my installed Java SDK in C:\Program Files is 1.6.0 , but still I get this error when I install my app to Webshere Application Server V7. What does offset=6 mean? I want to compile using Java 6 and Websphere 7 supports Java 6. I do see that the JDK in the IBM directory where server is installed is Java 7. Is that what is causing this? ....but again my workspace's Eclipse compiler is set to Java 1.6 . WebSphere Application

How to change settings for SQL Developer to correctly recognize current version of SDK

大憨熊 提交于 2019-11-27 07:39:44
问题 I've installed Oracle 11g r2 to my machine and when I opened Oracle SQL Developer it says: java 1.6.0_02 is not supported and telling me to install new java version. Then I've installed JDK 1.6.0_27 and set the path in environment variables and run Oracle SQL Developer again, but the same error occurred. How can I change the settings for Oracle SQL Developer to recognize 1.6.0_27 as my SDK? 回答1: sqldeveloper.conf under sqldeveloper/bin in the SQLDeveloper base directory has an entry for the