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:

Java SE 7 Features and Enhancements

2995 questions
38 answers

No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

I'm compiling a project in Eclipse using m2eclipse. I set the JDK path in Eclipse like this: Windows-->preferences-->installed jres--> jdk1.7.xx path But this is showing an error [ERROR] COMPILATION ERROR : [INFO]…
Sai prateek
  • 11,842
  • 9
  • 51
  • 66
7 answers

What is the point of the diamond operator (<>) in Java?

The diamond operator in java 7 allows code like the following: List list = new LinkedList<>(); However in Java 5/6, I can simply write: List list = new LinkedList(); My understanding of type erasure is that these are exactly the…
  • 7,682
  • 5
  • 22
  • 30
27 answers

Installed Java 7 on Mac OS X but Terminal is still using version 6

I've installed JDK 7u7 downloaded from oracle's website. But after installation, the terminal is still showing java version 6 $java -version java version "1.6.0_35" Java(TM) SE Runtime Environment (build 1.6.0_35-b10-428-11M3811) Java HotSpot(TM)…
  • 9,794
  • 15
  • 44
  • 52
4 answers

Create a Path from String in Java7

How can I create a java.nio.file.Path object from a String object in Java 7? I.e. String textPath = "c:/dir1/dir2/dir3"; Path path = ?; where ? is the missing code that uses textPath.
  • 12,998
  • 22
  • 72
  • 116
30 answers

Recursively list files in Java

How do I recursively list all files under a directory in Java? Does the framework provide any utility? I saw a lot of hacky implementations. But none from the framework or nio
Quintin Par
  • 15,862
  • 27
  • 93
  • 146
9 answers

Is "Java Concurrency In Practice" still valid?

Is Java Concurrency in Practice still valid? I am wondering whether the ideas, concepts and implementation described in the book are still compliant with the latest Java versions. I ask because the latest edition was done in 2006.
  • 10,247
  • 9
  • 32
  • 35
29 answers

How to set specific Java version to Maven?

On my machine I have two Java versions installed: (1.6 and 1.7 installed manually by me). I need both of them for different projects. But for Maven I need 1.7, but my Maven uses the 1.6 Java version. How can I set Maven to use 1.7?
  • 4,153
  • 7
  • 24
  • 36
3 answers

Java SafeVarargs annotation, does a standard or best practice exist?

I've recently come across the java @SafeVarargs annotation. Googling for what makes a variadic function in Java unsafe left me rather confused (heap poisoning? erased types?), so I'd like to know a few things: What makes a variadic Java function…
  • 4,152
  • 3
  • 30
  • 37
8 answers

java.nio.file.Path for a classpath resource

Is there an API to get a classpath resource (e.g. what I'd get from Class.getResource(String)) as a java.nio.file.Path? Ideally, I'd like to use the fancy new Path APIs with classpath resources.
Louis Wasserman
  • 191,574
  • 25
  • 345
  • 413
8 answers

Java 7 language features with Android

Just wondering if anyone has tried using new Java 7 language features with Android? I know that Android reads the bytecode that Java spits out and turns it to dex. So I guess my question is can it understand the bytecode of Java 7?
Daniel Ryan
  • 6,976
  • 5
  • 45
  • 62
8 answers

How to set -source 1.7 in Android Studio and Gradle

I'm getting following error when trying to compile my project in Android Studio: Gradle: error: diamond operator is not supported in -source 1.6 I have 1.7 set as target in all project preferences I've found. Also the path displayed in project…
  • 7,334
  • 11
  • 56
  • 79
5 answers

Can Java 8 code be compiled to run on Java 7 JVM?

Java 8 introduces important new language features such as lambda expressions. Are these changes in the language accompanied by such significant changes in the compiled bytecode that would prevent it from being run on a Java 7 virtual machine without…
Nicola Ambrosetti
  • 2,567
  • 3
  • 22
  • 38
5 answers

How should I use try-with-resources with JDBC?

I have a method for getting users from a database with JDBC: public List getUser(int userId) { String sql = "SELECT id, name FROM users WHERE id = ?"; List users = new ArrayList(); try { Connection con =…
  • 121,568
  • 97
  • 310
  • 388
2 answers

How to set IntelliJ IDEA Project SDK

I just installed IntelliJ IDEA and when I try to create my first Project it asks for me to set up the Project SDK. When I click on "JDK" it asks for me to select the home directory of the JDK as shown in this image. I'm having trouble locating…
  • 1,617
  • 2
  • 12
  • 7
5 answers

What is the difference between PermGen and Metaspace?

Until Java 7 there was an area in JVM memory called PermGen, where JVM used to keep its classes. In Java 8 it was removed and replaced by area called Metaspace. What are the most important differences between PermGen and Metaspace? The only…
  • 7,225
  • 9
  • 41
  • 65
2 3
99 100