Questions tagged [java-6]

Java SE version 6 was released in December 2006. Use this tag for questions specific to this version of Java.

Java SE 6 was an evolutionary change over the previous version. It did not include extensive language or JVM changes, however such changes were planned for Java SE 7 which was supposed to be released much sooner. (See here for what changed in Java 6).

As a stop-gap to the much delayed Java 7, Sun (since purchased by Oracle) introduced Java SE 6 Update 10, which despite its modest version numbering, represented extensive improvements to the GUI capabilities of Java in order to support JavaFX and Sun's renewed attempt to make Java successful in the GUI arena.

Internally, Java is numbered with a "1." before the number, so it will report itself as "1.6.0_" with an update number at the end. Starting with version 6, Sun dropped the ".0" from its marketed version number, so instead of 5.0 as previously done, it was Java 6.

Only use this tag if your question is specifically related to features of this version. Just because you are using this version, doesn't mean you need this tag. Use in addition to or instead of this tag.

See for more information.

1391 questions
47
votes
11 answers

How to convert java.lang.Object to ArrayList?

I have a valid ArrayList object in the form of java.lang.Object. I have to again convert the Object to an ArrayList. I tried this: Object obj2 = from some source . . ; ArrayList al1 = new ArrayList(); al1 = (ArrayList)…
sjain
  • 1,635
  • 9
  • 25
  • 35
44
votes
7 answers

Java 1.6 - determine symbolic links

In a DirectoryWalker class I want to find out if a File instance is actually a symbolic link to a directory (assuming, the walker walks on UNIX systems). Given, I already know the instance is a directory, would the following be a reliable condition…
mats
  • 1,818
  • 3
  • 18
  • 26
44
votes
3 answers

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

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?
Diablo.Wu
  • 1,151
  • 5
  • 15
  • 17
43
votes
12 answers

UnsupportedClassVersionError: JVMCFRE003 bad major version in WebSphere AS 7

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…
mi3
  • 581
  • 1
  • 7
  • 13
42
votes
6 answers

How to tell why a file deletion fails in Java?

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…
Arne Evertsson
  • 19,693
  • 20
  • 69
  • 84
36
votes
11 answers

Reasons and advantages for upgrading to Java 6 for a non-technical decider (at the client)

I'd like to upgrade from Java 5 to Java 6. We all know about the technical advantages and benefits, but: I have the problem that a major client refuses to upgrade from java 5 to java 6 because of "the risks" and "no/too few benefits for us" (banking…
MRalwasser
  • 15,605
  • 15
  • 101
  • 147
34
votes
15 answers

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

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…
Lakshitha Herath
  • 628
  • 2
  • 9
  • 18
30
votes
12 answers

Is there a Java utility which will convert a String path to use the correct File separator char?

I have developed a number of classes which manipulate files in Java. I am working on a Linux box, and have been blissfully typing new File("path/to/some/file");. When it came time to commit I realised some of the other developers on the project are…
Grundlefleck
  • 124,925
  • 25
  • 94
  • 111
30
votes
5 answers

Understanding logic in CaseInsensitiveComparator

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,…
Kevin
  • 781
  • 1
  • 9
  • 18
29
votes
5 answers

How do I get an inner class to inherit enclosing class' generic type?

I'm using Java 6. I'm having trouble getting my inner class to use the same generic class as its enclosing class. Currently I have public class TernarySearchTree < T > { ... protected class TSTNode < T > { // index values for…
Dave
  • 15,639
  • 133
  • 442
  • 830
28
votes
4 answers

Compiling Java 7 to Java 6

I'm aware that the runtime features of Java 7 are not available with Java 6 but since no new byte code has been added the new byte code invokedynamic is only relevant for non-Java languages, I was wondering how hard it would be to convert Java 7…
Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820
28
votes
8 answers

Getting the name of a method parameter

In Java 6, imagine I have the following method signature: public void makeSandwich(Bread slice1, Bread slice2, List fillings, boolean mustard) I would like to know, at runtime, the value that was passed on to slice2 or any other parameter,…
Tiago Veloso
  • 8,513
  • 17
  • 64
  • 85
27
votes
5 answers

How can I prevent PermGen space errors in Netbeans?

Every 15-30 minutes Netbeans shows a "java.lang.OutOfMemoryError: PermGen space". From what I learned from Google this seems to be related to classloader leaks or memory leaks in general. Unfortunately all suggestions I found were related to…
Daniel Rikowski
  • 71,375
  • 57
  • 251
  • 329
26
votes
3 answers

Split by first found String in Java

is ist possible to tell String.split("(") function that it has to split only by the first found string "("? Example: String test = "A*B(A+B)+A*(A+B)"; test.split("(") should result to ["A*B" ,"A+B)+A*(A+B)"] test.split(")") should result to…
Max_Salah
  • 2,407
  • 11
  • 39
  • 68
26
votes
1 answer

Forward compatible Java 6 annotation processor and SupportedSourceVersion

I am trying out Java 7 for one project and getting warnings from annotation processors (Bindgen and Hibernate JPA modelgen) of this sort: warning: Supported source version 'RELEASE_6' from annotation processor…
bernie
  • 9,820
  • 5
  • 62
  • 92
1
2
3
92 93