java-7

Maven Package Compilation Error

时光总嘲笑我的痴心妄想 提交于 2019-11-26 19:59:16
问题 i created a webapp project using maven in eclipse. when i run the command mvn package in command prompt it showing folowing error. [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? [INFO] 1 error [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------

Compiling Java 7 to Java 6

馋奶兔 提交于 2019-11-26 19:58:11
问题 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 source code (new switch statement, diamond operator) to pure Java 6 (i.e. to be able to start to convert the source to Java 7 without losing Java 6 compatibility). Any pointers? 回答1: Mark a .class file output by Java 7 javac with version 1.6.0 (i.e.

Java 7 JVM VerifyError in Eclipse

人走茶凉 提交于 2019-11-26 19:42:57
问题 When I compile my project in eclipse indigo using JDK 7, I get the following error dialog with the following stacktrace Exception in thread "main" java.lang.VerifyError: Expecting a stackmap frame at branch target 32 in method ... at offset 0 at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Unknown Source) at java.lang.Class.getMethod0(Unknown Source) at java.lang.Class.getMethod(Unknown Source) at sun.launcher.LauncherHelper.getMainMethod

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

笑着哭i 提交于 2019-11-26 19:25:53
问题 in Java 7 we have o.hashCode(); Objects.hashCode(o); Objects.hash(o); The first 2 are roughly the same with the null point check, but what is last one? When a single object reference is supplied, the returned value does not equal the hash code of that object reference. Why is that? I mean, we don't need 3 methods that do the same thing, I understand that, but why do we need Objects.hash() at all? When would you chose to use one vs another? 回答1: See the documentation for hashCode and hash.

How safe is it to use -XX:-UseSplitVerifier?

随声附和 提交于 2019-11-26 19:22:38
问题 There are known compatibility issues with JDK7 compiled code using instrumentation. As for http://www.oracle.com/technetwork/java/javase/compatibility-417013.html Classfiles with version number 51 are exclusively verified using the type-checking verifier, and thus the methods must have StackMapTable attributes when appropriate. For classfiles with version 50, the Hotspot JVM would (and continues to) failover to the type-inferencing verifier if the stackmaps in the file were missing or

invalid target release: 1.7

我们两清 提交于 2019-11-26 19:07:04
问题 I have seen similar questions, but haven't yet found the answer. Using maven compile, I get: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:compile (default-compile) on project api: Fatal error compiling: invalid target release: 1.7 -> [Help 1] Here is the pom.xml: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.0</version> <configuration> <source>1.7</source> <target>1.7</target> <encoding>UTF-8

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

假装没事ソ 提交于 2019-11-26 18:45:19
问题 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 unsafe in the @SafeVarargs sense (preferably explained in the form of an in-depth example)? Why is this annotation left to the discretion of the programmer? Isn't this something the compiler should be able to check? Is there some standard one must

Does Android support JDK 6 or 7 [duplicate]

人盡茶涼 提交于 2019-11-26 18:44:14
This question already has an answer here: diamond operator is not supported [duplicate] 4 answers I am new to Android development. Can I use my existing Java code developed using JDK 7 in Android? The functions use xerces dom and xslt and xpathapi. Currently when I installed Android Eclipse ADT environment these functions are not compiling. I would also like to know whether an Android device itself supports JRE 6 or 7? Muhammad Annaqeeb Originally Android development tools supported only jdk 6 features. But that was changed, first by Android Studio 0.3.2 in October 2013 see: http://tools

Am I using the Java 7 try-with-resources correctly

一个人想着一个人 提交于 2019-11-26 18:37:16
I am expecting the buffered reader and file reader to close and the resources released if the exception is throw. public static Object[] fromFile(String filePath) throws FileNotFoundException, IOException { try (BufferedReader br = new BufferedReader(new FileReader(filePath))) { return read(br); } } However, is there a requirement to have a catch clause for successful closure? EDIT: Essentially, is the above code in Java 7 equivalent to the below for Java 6: public static Object[] fromFile(String filePath) throws FileNotFoundException, IOException { BufferedReader br = null; try { br = new

Technically what is the main difference between Oracle JDK and OpenJDK? [duplicate]

你。 提交于 2019-11-26 18:14:25
This question already has an answer here: Differences between Oracle JDK and OpenJDK 10 answers I have been using OpenJDK for ages, initially for small projects where it has no problems. But since I started to play with it for big toys, I started to notice random/unknown fatal error and crashes (with H.264 codecs, etc.), and it was a nightmare till then to get ride of system crash+fatal errors caused by OpenJDK. After getting completely frustrated and tired with OpenJDK, I finally decided to switch into Oracle JDK 7. Since then my fatal errors/crashes were gone. I am still doing trace to see