java-7

Java OutOfMemory exception: mmap error on loading zip file

a 夏天 提交于 2019-11-30 12:24:28
I run my app on production env (rhel 5.2 x64, oracle jre 1.7_05, tomcat 7.0.28) with JVM arguments: -Xms8192m -Xmx8192m -XX:MaxPermSize=1024m -Doracle.net.tns_admin=/var/ora_net -XX:ReservedCodeCacheSize=512m -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -XX:+UseStringCache -XX:+OptimizeStringConcat -XX:+UseCompressedOops -XX:+UseG1GC -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9026 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false After several time i've got stack trace like that: Java HotSpot(TM) 64-Bit Server VM warning:

Will compiling for Java 1.5 on Java 1.7 still work?

偶尔善良 提交于 2019-11-30 11:42:54
I've recently moved to Java 7 in one of my projects. I claim that it can run on Java 1.5 simply because there's nothing I depend on that is in Java 6 or 7. However when compiling today I noticed this: bootstrap class path not set in conjunction with -source 1.5 Google has found little information on this warning. Does this mean that you can't compile to Java 1.5 from Java 1.7? This Oracle blog explains the warning: http://blogs.oracle.com/darcy/entry/bootclasspath_older_source The reason is, that if you fail to set rt.jar for the older platform, then: If the second step is not taken, javac

Changes in access of variables for generic classes in Java 7

…衆ロ難τιáo~ 提交于 2019-11-30 11:13:27
Here is a simple example of some code that compiles using Java 6, but does not compile in Java 7. public class Test<T extends Test> { private final int _myVar; public Test(int myVar) { _myVar = myVar; } public int get(TestContainer<T> container){ T t = container.get(); return t._myVar; } private static class TestContainer<T extends Test> { private final T _test; private TestContainer(T test) { _test = test; } public T get(){ return _test; } } } In Java 7, it fails to compile in the get(TestContainer<T> container) method, with the error: error: _myVar has private access in Test I don't

Get file/directory size using Java 7 new IO

江枫思渺然 提交于 2019-11-30 10:43:14
How can I get the size of a file or directory using the new NIO in java 7? Use Files.size(Path) to get the size of a file. For the size of a directory (meaning the size of all files contained in it), you still need to recurse manually, as far as I know. Here is a ready to run example that will also skip-and-log directories it can't enter. It uses java.util.concurrent.atomic.AtomicLong to accumulate state. public static void main(String[] args) throws IOException { Path path = Paths.get("c:/"); long size = getSize(path); System.out.println("size=" + size); } static long getSize(Path startPath)

Java AppBundler application pointing to JRE defined by JAVA_HOME

不问归期 提交于 2019-11-30 09:57:00
I have been using Java Application Bundler to pack a Java application as .app. I have managed to run the application if I pack the JRE7 inside of the .app bundle. Is it possible to configure .app (in Info.plist) to point to the JRE defined by JAVA_HOME environment variable? If I do that, I am getting "Unable to load Java Runtime Environment"! I have tried to configure the JAVA_HOME in different ways, but with no success! Can anyone provide any help or suggestion? appbundler applications can use either an embedded Java 7 JRE inside the app bundle, or the Java 7 JRE installed in /Library

File id for keeping track of file changes in Java?

[亡魂溺海] 提交于 2019-11-30 09:55:54
问题 I'm trying to find a way to keep track of files even when they are moved or renamed in the file system. One idea I had was to use the new UserDefinedFileAttributeView in Java 7 and create a custom file attribute as a sort of custom id. I thought that this might work on different platforms (Windows and Mac primarily). But I can't get it to work. Even trying the example on this page - http://docs.oracle.com/javase/tutorial/essential/io/fileAttr.html - When I get to this line:

InvokeDynamic from source code in JDK7

跟風遠走 提交于 2019-11-30 09:51:43
问题 Prerelease versions of JDK 7 contained a class java.dyn.InvokeDynamic that allowed creating invokedynamic instructions from source code. See here: http://fwierzbicki.blogspot.com/2009/08/invokedynamic-and-jython-part-i.html In the official JDK 7 release this class seems to have disappeared. Does anyone know if this source-code option is still supported? 回答1: java.dyn package has been renamed to java.lang.invoke. Though I don't think you can create the 'invokedynamic' instruction from Java,

Can't access synthetica themes on new netbeans 7.4 with latest JDK (1.7.0_45)

眉间皱痕 提交于 2019-11-30 09:43:02
问题 Today i was update my Netbeans 6.8 to new Netbeans 7.4 and JDK 1.7.0 to 1.7.0_45 When i open my previous project on new Netbeans version sysnthetica look and feel is not working :( other everything is working perfectly :) try { UIManager.setLookAndFeel(new SyntheticaBlackStarLookAndFeel()); new frm_login().setVisible(true); } catch (Exception e) { e.printStackTrace(); } this is the error : Exception in thread "main" java.lang.NoClassDefFoundError: sun/swing/plaf/synth/SynthUI at de.javasoft

What complexity are operations on Java 7's BigInteger?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 09:38:59
What complexity are the methods multiply , divide and pow in BigInteger currently? There is no mention of the computational complexity in the documentation (nor anywhere else). If you look at the code for BigInteger (provided with JDK), it appears to me that multiply(..) has O(n^2) (actually the method is multiplyToLen(..) ). The code for the other methods is a bit more complex, but you can see yourself. Note: this is for Java 6. I assume it won't differ in Java 7. There is a new "better" BigInteger class that is not being used by the sun jdk for conservateism and lack of useful regression

Java SE strong cryptography for Java 7? [closed]

独自空忆成欢 提交于 2019-11-30 09:17:40
The preview release of Java 7 seems to be missing JCE package for unlimited cryptography strength. Has someone stumbled upon such? http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html You need to install the missing JCE package. Locate your jre lib/security directory $ which java /usr/bin/java # Do this recursively till you find the java installation folder $ ls -la /usr/bin/java On Linux it should be by default: /usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/security/ On Windows it should be by default: C:\Program Files\Java\jre7\lib\security Download the Java