java-7

Android Studio - JDK Problems, Android Studio Meltdown

吃可爱长大的小学妹 提交于 2019-12-01 11:42:33
After I updated my Java JDK 8 from Update 40 to 45, all of my projects opened with errors. You know, the red letters over code. When I hit "Alt+Enter" it says to Setup JDK. I've tried uninstalling Java and Android Studio and came up with the same result. I've also tried using Java JDK 7 Update 80 but still come up with the same problems. Please look at these pictures because I don't think I have done a good job explaining the problem. http://i.stack.imgur.com/YaMar.png http://i.stack.imgur.com/gc02g.png Please help me because otherwise I don't see how I can develop android apps anymore. Any

Using Java 7 API to read a file byte by byte

Deadly 提交于 2019-12-01 11:40:00
问题 I have a 2 gb file I want to read in Java (actually four 2gb files). And so there's a new feature in Java 7 that can let me read all the bytes at once. import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; public class reconstructor { public static void main(String[] args) throws IOException { Path p = Paths.get("test.txt"); for (int i = 0; i < 1; i++) { byte[] b = Files.readAllBytes(p); Files

JMenu consumes focuslost event in Windows7 LAF Java7

▼魔方 西西 提交于 2019-12-01 11:36:57
If a popup menu is still open when another component is clicked, then the component does not get the event, because it's probably consumed by the popup. This happens for all JPopupmenus in general. This happens only in Java 7 with windows LAF (Windows7). Is there a workaround? Is it a known bug? import javax.swing.*; import java.awt.event.*; public class Test { public static void main(String[] s) throws Exception { String lookAnfFeelClassName = UIManager.getSystemLookAndFeelClassName(); UIManager.setLookAndFeel(lookAnfFeelClassName); JMenu menu = new JMenu("TEST Menu"); JMenuItem menuItem =

add glassfish javax.persistence to gradle project

China☆狼群 提交于 2019-12-01 11:21:42
i getting this error % gradle build [ant:javac] Hello.java:2: error: package javax.persistence does not exist Hello.java:2: import javax.persistence.*; what should i add to gradle.build to include /opt/glassfish3/glassfish/modules/javax.persistence.jar thx Try adding compile group: 'javax.persistence', name: 'persistence-api', version: '1.0' to your dependencies. 来源: https://stackoverflow.com/questions/9271849/add-glassfish-javax-persistence-to-gradle-project

Server closes connections made using httpclient and Java 7

房东的猫 提交于 2019-12-01 10:03:55
问题 I am trying to connect to a remote server that serves certificates using SNI. I noticed that the server is closing connections made when I compile and run code using Java 7 and not when I compile and run it via Java 8. Below is the code that i made to test this assumption. I switch Java versions and run the code and get different results. public static void getRequest() throws IOException, NoSuchAlgorithmException, KeyManagementException { String url = "https://sorry i can not share the exact

How and why does “setenforce 0” allow Java 7 to run? [closed]

百般思念 提交于 2019-12-01 09:12:11
I've made some changes on a program I'm working on and I've updated Java from Java 6 to Java 7. I am running the program on a CentOS 5.8 32-bit VM. Before the Java update it worked fine. Now the process isn't starting with the error: [root@CentOS-58-i-0 bin]# ./agent.sh start Starting Agent.....d. running (23442). Error: dl failure on line 864 Error: failed /agent/jre/lib/i386/client/libjvm.so, because /agent/jre/lib/i386/client/libjvm.so: cannot restore segment prot after reloc: Permission denied I've checked online and the solution/workaround for this is to run the command: setenforce 0 and

How and why does “setenforce 0” allow Java 7 to run? [closed]

只愿长相守 提交于 2019-12-01 06:59:56
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I've made some changes on a program I'm working on and I've updated Java from Java 6 to Java 7. I am running the program on a CentOS 5.8 32-bit VM. Before the Java update it worked fine. Now the process isn't starting with the error: [root@CentOS-58-i-0 bin]# ./agent.sh start Starting Agent.....d. running (23442

Understanding how to resolve “Inconsistent stackmap frames” exception

喜你入骨 提交于 2019-12-01 06:28:00
I get an exception on startup of the web application as guice is trying to construct the class mentioned. java.lang.VerifyError: Inconsistent stackmap frames at branch target 2770 in method com.aptusi.apps.magazine.api.servlet.internal.EditorServlet.service(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;Ljava/lang/String;Lcom/aptusi/persistence/runtime/framework/DboSession;)V at offset 200 at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2483) at java.lang.Class.getDeclaredConstructors(Class

ParamConverterProvider method return type mismatch

被刻印的时光 ゝ 提交于 2019-12-01 05:40:22
In the below code snippet I keep receiving the following error in the Provider class. Type mismatch: cannot convert from DemoParamConverter to ParamConverter package com.ofss.shop.application.translators; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import javax.ws.rs.ext.ParamConverter; import javax.ws.rs.ext.Provider; @Provider public class DemoParamConverterProvider { private final DemoParamConverter dpc = new DemoParamConverter(); public <T> ParamConverter<T> getConverter(Class<T> rawType, Type genericType, Annotation[] annotations) { return dpc; } } package com

String.format() throws FormatFlagsConversionMismatchException

爷,独闯天下 提交于 2019-12-01 05:22:22
This code works fine in Java 1.6: public static String padLeft(String s, int n) { if (n <= 0) return s; int noOfSpaces = n * 2; String output; noOfSpaces = s.length() + noOfSpaces; output = String.format("%1$#" + noOfSpaces + "s", s); return output; } But newer versions (and some other VM implementations) throw this Exception : java.util.FormatFlagsConversionMismatchException: Mismatched Convertor =s, Flags= # at java.util.Formatter$Transformer.transformFromString(Formatter.java:1020) at java.util.Formatter$Transformer.transform(Formatter.java:861) at java.util.Formatter.format(Formatter.java