Questions tagged [java-7]

Java SE version 7 was released in 2011. The new features, in comparison to the version 6, include dynamic language support, compressed pointers, small language extensions, elliptic curve cryptography, new network protocols, the ability to use Strings as case values in a switch statement, and various system library extensions.

Oracle has two products that implement Java Platform Standard Edition (Java SE) 7: Java SE Development Kit (JDK) 7 and Java SE Runtime Environment (JRE) 7.

JDK 7 is a superset of JRE 7, and contains everything that is in JRE 7, plus tools such as the compilers and debuggers necessary for developing applets and applications. JRE 7 provides the libraries, the Java Virtual Machine (JVM), and other components to run applets and applications written in the Java programming language.

The following conceptual diagram illustrates Java component technologies:

Java component technologies stack

See for more information.

Java 7 Official Documentation: http://docs.oracle.com/javase/7/docs/api/

Java SE 7 Features and Enhancements

2995 questions
82
votes
8 answers

Java 7 (JDK 7) garbage collection and documentation on G1

Java 7 has been out for a while now, but I cannot find any good resources on the configuration of the garbage collectors, specifically the new G1 collector. My questions: Is G1 the default collector in Java 7 and if not how do I activate G1? What…
Florakel
  • 1,131
  • 1
  • 10
  • 8
82
votes
4 answers

How Numeric literal with underscore works in java and why it was added as part of jdk 1.7

Can somebody please explain to me why this feature was added in JDK 7 and how it works? While going through the new features of JDK 7, I found following code. int i; //Java 7 allows underscore in integer i=3455_11_11;
Dark Knight
  • 8,218
  • 4
  • 39
  • 58
77
votes
4 answers

Which JDK version (Language Level) is required for Android Studio?

I am a new comer to the android world and with a .NET background. I am trying to install the Android Studio but I am having a mismatch on Android.com about the JDK version required for developing Android applications. From the SDK web page it states…
Moslem Ben Dhaou
  • 6,897
  • 8
  • 62
  • 93
77
votes
1 answer

Installing Java 7 (Oracle) in Debian via apt-get

Installing Oracle Java 7 in Debian via apt-get repository doesn't seems to work. apt-get install oracle-java7-installer Look like apt-get does not recognize oracle-java7-installer.
AzizSM
  • 6,199
  • 4
  • 42
  • 53
77
votes
3 answers

Objects.hash() vs Objects.hashCode(), clarification needed

Since Java 7, we have o.hashCode(); Objects.hashCode(o); Objects.hash(o); The first two are roughly the same with the null check, but what is last one? When a single object reference is supplied, the returned value does not equal the hash code of…
James Raitsev
  • 92,517
  • 154
  • 335
  • 470
76
votes
2 answers

Why is StringBuilder#append(int) faster in Java 7 than in Java 8?

While investigating for a little debate w.r.t. using "" + n and Integer.toString(int) to convert an integer primitive to a string I wrote this JMH microbenchmark: @Fork(1) @OutputTimeUnit(TimeUnit.MILLISECONDS) @State(Scope.Benchmark) public class…
thkala
  • 84,049
  • 23
  • 157
  • 201
74
votes
9 answers

Java 7 prevents FTP transfers on Windows Vista and 7 if firewall is on. Any ideas?

Java 7 prevents FTP transfers on Windows Vista and 7. In FTP, before a file is transferred a PORT or a PASV command must be sent. As soon as one of the commands is sent the Windows Firewall closes the socket that sent it. This only happens if the…
HansA
  • 1,375
  • 2
  • 11
  • 19
73
votes
2 answers

How to access a sub-file/folder in Java 7 java.nio.file.Path?

Java 7 introduced java.nio.file.Path as a possible replacement for java.io.File. With File, when I access a file under a specific, I would do: File parent = new File("c:\\tmp"); File child = new File(parent, "child"); // this accesses…
ripper234
  • 222,824
  • 274
  • 634
  • 905
72
votes
3 answers

Why is my URI not hierarchical?

I have files in resource folder. For example if I need to get file from resource folder, I do like that: File myFile= new File(MyClass.class.getResource(/myFile.jpg).toURI()); …
grep
  • 5,465
  • 12
  • 60
  • 112
71
votes
4 answers

Java access files in jar causes java.nio.file.FileSystemNotFoundException

While trying to copy some files in my jar file to a temp directory with my java app, the following exception is thrown: java.nio.file.FileSystemNotFoundException at…
tom91136
  • 8,662
  • 12
  • 58
  • 74
69
votes
9 answers

How to install java jdk 7 on Snow Leopard

My Mac currently is running Snow Leopard (10.6.8), and I would like to develop with Java 7. I downloaded the Java 7 OS X installer from Oracle's website, started to run it. Unfortunately, I was immediately greeted with a message that said the…
dnc253
  • 39,967
  • 41
  • 141
  • 157
66
votes
5 answers

How serious is the Java7 "Solr/Lucene" bug?

Apparently Java7 has some nasty bug regarding loop optimization: Google search. From the reports and bug descriptions I find it hard to judge how significant this bug is (unless you use Solr or Lucene). What I'd like to know: How likely is it that…
Carsten
  • 4,204
  • 4
  • 32
  • 49
63
votes
7 answers

What's the purpose of try-with-resources statements?

Java 7 has a new feature called try-with-resources. What is it? Why and where we should use it and where we can take advantage of this feature? The try statement has no catch block which confuses me.
user2589993
62
votes
8 answers

Java 7 underscore in numeric literals

When we must use a _ to separate digits in a number I don't understand the following case in which I can't use it: In positions where a string of digits is expected (as documented in the JDK7 guide here) Some examples?
xdevel2000
  • 20,780
  • 41
  • 129
  • 196
60
votes
11 answers

How to enable TLS 1.2 in Java 7

I am trying to enable TLS 1.2 in my web app which uses JBoss 6.4 and Java 1.7. I have -Dhttp.protocols = TLSv1.2 in my application environment but it doesn't seem to work for me. Is there anything I could do to enable TLS 1.2? I wrote a simple…
New Bee
  • 603
  • 1
  • 5
  • 6