java-7

lower case of turkish character dotted i

南楼画角 提交于 2019-11-29 07:33:26
In Java 6, System.out.println(String.valueOf('\u0130').toLowerCase()); prints i ( u0069 ), but in Java 7 it prints i with double dots ( u0069 u0307 ). I understand it is a Turkish character, but how do I make Java 7 print the same output as v6 using this code? System.out.println(inputText.toLowerCase()); Also make sure that the code can handle international text without hardcoding the toLowerCase function to use only Turkish locale. There is a quite detailed blog post about this i toLowerCase problem Let me try to summarize the essential parts: In Java 7 this method has indeed changed and

Access is denied while compiling Java on Windows

杀马特。学长 韩版系。学妹 提交于 2019-11-29 06:47:51
I created two java files: Pizza.Java and PizzaOrder.Java . I tried compiling my code using javac in the command prompt like this: javac pizzaorder.java I am getting access is denied error: C:\Users\Meutex>cd\ C:\>cd "Program Files\Java\jdk1.7.0\bin" C:\Program Files\Java\jdk1.7.0\bin>javac PizzaOrder.java PizzaOrder.java:23: error: cannot find symbol Pizza order = new Pizza (); ^ symbol: class Pizza location: class PizzaOrder PizzaOrder.java:23: error: cannot find symbol Pizza order = new Pizza (); ^ symbol: class Pizza location: class PizzaOrder 2 errors C:\Program Files\Java\jdk1.7.0\bin

Why is Java 7 Files.walkFileTree throwing exception on encountering a tar file on remote drive

爱⌒轻易说出口 提交于 2019-11-29 05:36:05
Im using Files.WalkFileTree() to navigate folder and counting audio files, but there is a problem when it encounters a tar file, it seems to be treating it as an actual folder I was expecting it to just skip over it. I cannot see any options that let me control this behaviour Code: package com.jthink.songkong.fileloader; import com.jthink.songkong.cmdline.SongKong; import com.jthink.songkong.ui.MainWindow; import java.nio.file.*; import java.nio.file.attribute.BasicFileAttributes; import java.util.concurrent.Callable; import java.util.logging.Level; /** * Count the number of files that can be

Java ternary operator influence on generics type inference

这一生的挚爱 提交于 2019-11-29 05:25:41
public List<String> foo1() { List<String> retval = bar(); if (retval == null) return Collections.emptyList(); else return retval; } public List<String> foo2() { List<String> retval = bar(); return retval == null ? Collections.emptyList() : retval; } Why does foo1() compiles fine whereas foo2() has an error? (to be more precise "Type mismatch: cannot convert from List<capture#1-of ? extends Object> to List<String>" ) I would have thought that both functions would compile to the same bytecode, so a clever compiler should infer the correct type for emptyList() ... Compiles for me fine in java 8.

Java 7 on 32-bit Windows 7 - Java Webstart - Unable to load resource

半城伤御伤魂 提交于 2019-11-29 04:52:08
Java 7 on 32-bit Windows 7 - Java Webstart - Unable to load resource I can't launch any java webstart application on a 32-bit Windows 7 system. E.g. ArgoUML - http://argouml-downloads.tigris.org/jws/argouml-latest-stable.jnlp Everything works fine with Java 6, but with Java 7 I get this kind of errors: Unable to load resource: java.io.IOException: Error writing to server or java.net.SocketException: Connection reset Java version: Java Web Start 10.7.2.11 Using JRE version 1.7.0_07-b11 Java HotSpot(TM) Client VM Here is the trace log: Log started: pe, 21 syys 2012 21:04:19 +0300 basic: Java

How to replace File.listFiles(FileFilter filter) with nio in Java 7?

自古美人都是妖i 提交于 2019-11-29 03:18:45
I have some file I/0 traversal code written in Java 6, trying to move it the New I/O in Java 7 but I cannot find any replacement for this kind of stuff. File[] files = dir.listFiles(AudioFileFilter.getInstance()); Namely, no way to filter paths only files, and it returns list of files so I would then have to convert each file to path (file.toPath) if I wanted to limit the use of File in methods it calls, which seems rather laborious. I did look at FileVisitor but this does not seem to allow you to control how the the tree is traversed so I don' think it will work for me. So how much of a

Performance of the compiled vs. interpreted javascript in java7 / Rhino

柔情痞子 提交于 2019-11-29 03:01:52
问题 I have a problem with performance of Rhino javascript engine in Java7, shortly - my script (that parses and compiles texts) runs in Chrome around 50-100 times quicker than the same in Java7 Rhino script engine. I was trying to find the way to improve situation and have found that Rhino supports compilation of scripts. I tried doing it with my scripts and actually did not see any improvement. Finally - i ended up with a dummy short test suite where i do not see any difference in performance

private bytes increase for a javaw process in java 8

醉酒当歌 提交于 2019-11-29 02:51:03
问题 My project has started using java 8 from java 7. After switching to java 8, we are seeing issues like the memory consumed is getting higher with time. Here are the investigations that we have done : Issues comes only after migrating from java7 and from java8 As metaspace is the only thing related to memory which is changes from hava 7 to java 8. We monitored metaspace and this does not grow more then 20 MB. Heap also remains consistent. Now the only path left is to analyze how the memory gets

Why collection literals?

谁说胖子不能爱 提交于 2019-11-29 01:45:56
问题 From the various online articles on Java 7 I have come to know that Java 7 will be having collection literals 1 like the following: List<String> fruits = [ "Apple", "Mango", "Guava" ]; Set<String> flowers = { "Rose", "Daisy", "Chrysanthemum" }; Map<Integer, String> hindiNums = { 1 : "Ek", 2 : "Do", 3 : "Teen" }; My questions are: Wouldn't it have been possible to provide a static method of in all of the collection classes which could be used as follows: List<String> fruits = ArrayList.of(

com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file: target process not responding or HotSpot VM not loaded

无人久伴 提交于 2019-11-29 01:25:53
问题 I get AttachNotSupportedException while running jmockit tests on linux (ubuntu 64bit). Java version is 1.7.0_51. This JDK is from Oracle. Tests are run using ant(that probably is not relevant) See the stack trace. [junit] [junit] java.lang.RuntimeException: com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file: target process not responding or HotSpot VM not loaded [junit] at mockit.internal.startup.JDK6AgentLoader.getVirtualMachineImplementationFromEmbeddedOnes