jdk1.6

TimeZone.setDefault changes in JDK6

纵饮孤独 提交于 2019-11-27 04:33:21
问题 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

Eclipse crashes at startup; Exit code=13

巧了我就是萌 提交于 2019-11-27 02:14:54
I am trying to work with Eclipse Helios on my x64 machine (Im pretty sure now that this problem could occur with any eclipse) but it just doesn't cooperate. When I try to run eclipse I get the following: I have installed Helios EE x64 (latest version) JDK 1.6.025 (x64) I have linked my Environment Variables up correctly and tried to compile a Java file through cmd and have succeeded. Whenever I tried running eclipse i get exit code=13 (required java version=1.5) I tried running the following in cmd: -vm "mypath\jdk1.6.025\jre\bin" command as forums suggested as well as other paths -vm "mypath

HttpURLConnection implementation

大憨熊 提交于 2019-11-27 02:10:35
问题 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

How to tell why a file deletion fails in Java?

我只是一个虾纸丫 提交于 2019-11-26 20:51:45
File file = new File(path); if (!file.delete()) { throw new IOException( "Failed to delete the file because: " + getReasonForFileDeletionFailureInPlainEnglish(file)); } Is there a good implementation of getReasonForFileDeletionFailureInPlainEnglish(file) already out there? Or else I'll just have to write it myself. In Java 6, there is unfortunately no way to determine why a file cannot be deleted. With Java 7, you can use java.nio.file.Path#delete() instead, which will give you a detailed cause of the failure, if the file or directory cannot be deleted. Note that file.list() may return entries

java.lang.UnsupportedClassVersionError Unsupported major.minor version 51.0 [duplicate]

元气小坏坏 提交于 2019-11-26 19:30:03
Possible Duplicate: unsupported major .minor version 51.0 I am trying to build an application, but it gives some error. My JDK version is given below: java version "1.6.0_30" Java(TM) SE Runtime Environment (build 1.6.0_30-b12) Java HotSpot(TM) Client VM (build 20.5-b03, mixed mode, sharing) Here is my Error Log: Buildfile: build.xml compile: [echo] Compiling the service.... [echo] ...mkdir for classes first.... [echo] ...java classes next.... [echo] ...mkdir for generated code next.... [echo] ...generate stubs/skeletons next.... [wscompile] command line: wscompile -d /home/vivekray/program

How to set classpath when I use javax.tools.JavaCompiler compile the source?

假如想象 提交于 2019-11-26 14:38:50
I use the class javax.tools.JavaCompiler (jdk6) to compile a source file, but the source file depends on some jar file. How to set the classpath of the javax.tools.JavaCompiler ? The javax.tools.JavaCompiler#getTask() method takes an options parameter that allows to set compiler options. The following message describes an easy way to set them in order to access the calling program's classpath: You need to configure the standard java file manager to know about the jar files(s) - you use the compiler options argument to do that. By default the java compiler object only seems to know about the

UnsupportedClassVersionError: JVMCFRE003 bad major version in WebSphere AS 7

…衆ロ難τιáo~ 提交于 2019-11-26 13:56:45
问题 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

java.lang.UnsupportedClassVersionError Unsupported major.minor version 51.0 [duplicate]

泪湿孤枕 提交于 2019-11-26 06:58:52
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: unsupported major .minor version 51.0 I am trying to build an application, but it gives some error. My JDK version is given below: java version \"1.6.0_30\" Java(TM) SE Runtime Environment (build 1.6.0_30-b12) Java HotSpot(TM) Client VM (build 20.5-b03, mixed mode, sharing) Here is my Error Log: Buildfile: build.xml compile: [echo] Compiling the service.... [echo] ...mkdir for classes first.... [echo] ...java

Understanding logic in CaseInsensitiveComparator

送分小仙女□ 提交于 2019-11-26 05:35:22
问题 Can anyone explain the following code from String.java , specifically why there are three if statements (which I\'ve marked //1 , //2 and //3 )? private static class CaseInsensitiveComparator implements Comparator<String>, java.io.Serializable { // use serialVersionUID from JDK 1.2.2 for interoperability private static final long serialVersionUID = 8575799808933029326L; public int compare(String s1, String s2) { int n1=s1.length(), n2=s2.length(); for (int i1=0, i2=0; i1<n1 && i2<n2; i1++, i2

How to define a relative path in java

大兔子大兔子 提交于 2019-11-26 02:10:38
问题 Here is the structure of my project : I need to read config.properties inside MyClass.java . I tried to do so with a relative path as follows : // Code called from MyClass.java File f1 = new File(\"..\\\\..\\\\..\\\\config.properties\"); String path = f1.getPath(); prop.load(new FileInputStream(path)); This gives me the following error : ..\\..\\..\\config.properties (The system cannot find the file specified) How can I define a relative path in Java? I\'m using jdk 1.6 and working on windows