java-7

New features in java 7

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 10:04:26
What new features in java 7 is going to be implemented? And what are they doing now? didxga Java SE 7 Features and Enhancements from JDK 7 Release Notes This is the Java 7 new features summary from the OpenJDK 7 features page : vm JSR 292: Support for dynamically-typed languages (InvokeDynamic) Strict class-file checking lang JSR 334: Small language enhancements (Project Coin) core Upgrade class-loader architecture Method to close a URLClassLoader Concurrency and collections updates (jsr166y) i18n Unicode 6.0 Locale enhancement Separate user locale and user-interface locale ionet JSR 203: More

Sending email using JSP

本小妞迷上赌 提交于 2019-11-27 09:47:52
This problem is driving me nuts. I have the following code: <html> <body> <%@ page import="java.util.*" %> <%@ page import="javax.mail.*" %> <%@ page import="javax.mail.internet.*" %> <%@ page import="javax.activation.*" %> <% String host = "exchsrv2"; String to = "alan@domain.com"; String from = "apeince@domain.com"; String subject = "test"; String messageText = "body test"; Properties props = System.getProperties(); props.put("mail.host", host); props.put("mail.transport.protocol", "smtp"); props.put("mail.smtp.port", "25"); Session mailSession = Session.getDefaultInstance(props, null);

How serious is the Java7 “Solr/Lucene” bug?

只愿长相守 提交于 2019-11-27 09:39:10
问题 Apparently Java7 has some nasty bug regarding loop optimization: Google search. From the reports and bug descriptions I find it hard to judge how significant this bug is (unless you use Solr or Lucene). What I'd like to know: How likely is it that my (any) program is affected? Is the bug deterministic enough that normal testing will catch it? Note: I can't make users of my program use -XX:-UseLoopPredicate to avoid the problem. 回答1: The problem with any hotspot bugs, is that you need to reach

Create a Path from String in Java7

最后都变了- 提交于 2019-11-27 09:18:43
问题 How can I create a java.nio.file.Path object from a String object in Java 7? I.e. String textPath = "c:/dir1/dir2/dir3"; Path path = ?; where ? is the missing code that uses textPath . 回答1: You can just use the Paths class: Path path = Paths.get(textPath); ... assuming you want to use the default file system, of course. 回答2: From the javadocs..http://docs.oracle.com/javase/tutorial/essential/io/pathOps.html Path p1 = Paths.get("/tmp/foo"); is the same as Path p4 = FileSystems.getDefault()

How to set a java compiler in Netbeans

孤街浪徒 提交于 2019-11-27 09:12:45
I'm getting into Java7 development and I've added JDK7 into Java Platforms and have selected it in the project properties. But when I'm compiling, I get messages like: warning: java/lang/Boolean.class(java/lang:Boolean.class): major version 51 is newer than 50, the highest major version supported by this compiler. It is recommended that the compiler be upgraded. and javac: invalid target release: 1.7 /Applications/NetBeans/NetBeans 7.1.app/Contents/Resources/NetBeans/harness/suite.xml:184: The following error occurred while executing this line: /Applications/NetBeans/NetBeans 7.1.app/Contents

Java SimpleDateFormat Parse Wrong Date

杀马特。学长 韩版系。学妹 提交于 2019-11-27 08:29:11
问题 I'm trying to use the parse function of SimpleDateFormat to turn a String into a Date SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-YYYY"); String strInput1 = "29-04-2014"; System.out.println("string 1: " + strInput1); Date date1 = new Date(); try { date1 = sdf.parse(strInput1); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("date 1: " + date1.toString()); String strInput2 = sdf.format(date1); System.out.println("string 2: "

Reordering JList with Drag and Drop

馋奶兔 提交于 2019-11-27 07:39:40
问题 I encountered a problem regarding reordering elements in a JList using Drag and Drop. This following code is a modification of a code where you could drag elements from one JList to another (worked only one way). I tried to make it usable for only one JList, but the elements can't even be dragged out of the list. So I guess it can't be done this way. Any ideas what I'm doing wrong or not taking into consideration? The idea is to get it to work for a Jlist with thumbnails, but since I can't

Is Tomcat 7 now compatible with Java 7?

房东的猫 提交于 2019-11-27 07:38:52
问题 If not, when is it foreseen for? If yes, do you know if there is something special to migrate an existing installation of Tomcat 7/Java 6 to Tomcat 7/Java 7? Thanks! 回答1: Officially Java 1.6 or later is supported. This post goes into more detail. 回答2: Last month (Feb. 2013) I updated my Java from 1.6 to 1.7. However, the update has repercussion - Tomcat 7.0.37 is not running anymore after the Java update. I tried un-installing the Java 1.7, replace with 1.6 and the Apache Tomcat runs smoothly

java.lang.UnsupportedOperationException: 'posix:permissions' not supported as initial attribute on Windows

本秂侑毒 提交于 2019-11-27 07:36:07
问题 I am using Java 7 File API. I wrote a class that is working fine on Ubuntu creating directories perfectly, but when I run same code on Windows then it is throwing error: Exception in thread "main" java.lang.UnsupportedOperationException: 'posix:permissions' not supported as initial attribute at sun.nio.fs.WindowsSecurityDescriptor.fromAttribute(Unknown Source) at sun.nio.fs.WindowsFileSystemProvider.createDirectory(Unknown Source) at java.nio.file.Files.createDirectory(Unknown Source) at java

TTF and OTF versions of Source Sans Pro are differently displayed in Swing (Nimbus L&F)

折月煮酒 提交于 2019-11-27 07:21:29
问题 ttf: otf: both are the same font but different fontfile types I am running Java 7 in Windows 7 According to Miguel Sousa by Adobe the bug is not in the fonts https://github.com/adobe/source-sans-pro/issues/32#issuecomment-23319673 I am just setting the default font to the new font. The TTF version works without any issues Font font_o = Font.createFont(Font.TRUETYPE_FONT, fonts.class.getResourceAsStream("fonts/TTF/SourceSansPro-Regular.ttf")); //Font font_o = Font.createFont(Font.TRUETYPE_FONT