java-7

Access restriction on jdk1.7/jre/lib/rt.jar

≡放荡痞女 提交于 2019-12-10 00:50:17
问题 hi folks I faced a very strange while creating my JAXB parser. When i tried to generate JAXB classes from eclipse then in one class it shows a very Strange error which is Access restriction: The type QName is not accessible due to restriction on required library /usr/lib/jvm/jdk1.7.0_02/jre/lib/rt.jar this is my class package generated; import javax.xml.bind.JAXBElement; import javax.xml.bind.annotation.XmlElementDecl; import javax.xml.bind.annotation.XmlRegistry; //import javax.xml.namespace

Why java complains about jar files with lots of entries?

梦想与她 提交于 2019-12-09 14:37:56
问题 I stumbled upon following problem - when I create .jar file with more than 65k entries, java complains "Invalid or corrupt jarfile". Example: $ # in fresh dir $ for i in {1..70000}; do touch $i; done $ jar cf app.jar {1..70000} $ java -jar app.jar Error: Invalid or corrupt jarfile app.jar But if I use a bit less files, it works: $ jar cf app.jar {1..60000} $ java -jar app.jar no main manifest attribute, in app.jar I heard that there was 65k files limit in old .zip file format, but Java 7

Java Issue: Memory and CPU usage in MAC OS

旧巷老猫 提交于 2019-12-09 12:14:47
问题 I am developing a javaFx application for MAC and Windows, and I found that the application is using extremely large memory and cpu usage in MAC compared to Windows. When I see my application's activity in Windows Task Manager, it shows usage of average 80MB memory and 1-2% CPU which reaches it maximum of 150MB and 12-15% CPU. On the other hand in MAC Activity Monitor the same application shows 150MB and 12-15% CPU at starting and increases continuously beyond 1GB and 90%CPU. This is a very

What community version of Jboss is recommended for jdk 1.7 and why

℡╲_俬逩灬. 提交于 2019-12-09 07:33:12
问题 I need to migrate from Jboss 5.1.0 GA to any other that supports jdk 1.7. I'm currently using jboss 5.1 with seam 2, jdk 1.6 and sqlserver 2008 r2. What community version of Jboss is recommended for jdk 1.7 and why? Thanks in advance! 回答1: You can actually get JBoss AS 5.1.0 GA to run on JDK 7, see JBAS-6981. All of the following options will work with JDK 7: JBoss AS 5.1.0 (plus the fix for JBAS-6981) JBoss AS 6.1.0 JBoss AS 7.1.1 JBoss EAP 6.2 WildFly AS 8 CR 1 The right solution depends on

Dynamically run java code with Process

泄露秘密 提交于 2019-12-09 06:51:27
I have created a class that dynamically compiles, loads in a CustomClassLoader, and executes an in-memory java source (i.e.: without class files) java source by invoking it's main method. I need to capture the StdOut , StdIn , and StdErr , although it's not possible doing so in my current code. ( Compiler API + Classloader + Reflection ) My requirements might be the same as asked in this question - and as suggested by the accepted answer - use java.lang.Process . This is easier if I had physical files available in the file system, but I have not in this case. I am planning to remove the

JSR305 vs. JSR308 (Java Type Anotations) - Which is going to be the standard?

只愿长相守 提交于 2019-12-09 04:37:42
问题 There seem to be two different JSRs for annotations. JSR-305: Annotations for Software Defect Detection (additional resource) JSR-308: Annotations on Java Types (additional resource) Both seem to be oriented towards static code analysis. Do you know: which of the both is going to be either in Java SE 7 or Java EE 6? how "stable" is each JSR? does the one supersedes (or obsoletes) the other? 回答1: I can answer your last question. They are not the same thing. 305 is about new annotations where

ParamConverterProvider method return type mismatch

雨燕双飞 提交于 2019-12-09 03:16:59
问题 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>

How to do a call through a javax.xml.ws.Service

别来无恙 提交于 2019-12-09 00:57:15
问题 Created a new standard java 7 project in Eclipse and have successfully managed to get an instance of a javax.xml.ws.Service like so: String wsdlURL = "http://example.com:3000/v1_0/foo/bar/SomeService?wsdl"; String namespace = "http://foo.bar.com/webservice"; String serviceName = "SomeService"; QName serviceQN = new QName(namespace, serviceName); Service service = Service.create(new URL(wsdlURL), serviceQN); This runs fine in a main method, so as far as I can see, that part works. But I can't

When does TimSort complain about broken comparator?

给你一囗甜甜゛ 提交于 2019-12-09 00:09:45
问题 Java 7 changed the sorting algorithm such that it throws an java.lang.IllegalArgumentException: "Comparison method violates its general contract!" in some cases when the used comparator is buggy. Is it possible to tell what kind of bug in the comparator causes this? In my experiments it did not matter if x != x , it also did not matter if x < y and y < z but z < x , but it did matter if x = y and y = z but x < z for some values x, y, z. Is this generally so? (If there were a general rule to

(use -source 7 or higher to enable strings in switch) error;Netbeans 7.1.2

梦想的初衷 提交于 2019-12-08 18:14:17
问题 I am using JDK 7 and Netbeans IDE 7.1.2. Going through Using string in switch Was trying to compile that sample example in my IDE but I am getting this error. switch (month.toLowerCase()) { (use -source 7 or higher to enable strings in switch) 1 error Need your help. Thanks 回答1: You need to set the source for your project, right click > properties > source > set here 回答2: In general on "-source 7": use JDK7 (For example if you are normally using JDK 6 and just want to use JDK 7 for a special