java-7

Testng, Emma, Cobertura, coverage and JDK 7 result in ClassFormatError and VerifyError

我只是一个虾纸丫 提交于 2019-11-26 16:07:43
I have switched to the newest JDK 7 and I am having problems with running testng unit test on byte code that is fiddled by emma coverage tool. None of my test cases are run correctly and for most of them I am receiving such errors. java.lang.ClassFormatError: Illegal local variable table length 10 in method measurement.meter.AbstractSerialPortMeter.<init>(Lmeasurement/meter/SerialPort;)V at measurement.meter.Elc3133aTest.setUp(Elc3133aTest.java:42) I have found an article here JSR 292 Goodness Fast Code Coverage Tool Less 10k , which is saying that "JSR 292 introduces a new bytecode

PKIX Path does not chain with any of the trust anchors error in Windows Environment

纵饮孤独 提交于 2019-11-26 16:02:02
问题 I am a bit of an idiot to how SSL and Webservices work at the fine-grained level. I am developing a system that calls several web services, some with secured URLs and others that are not with little problem. Currently, however, I am doing an integration with Endicia's LabelServer Web API. The webservice is used to calculate and print postage. The test URL and WSDL is at: https://www.envmgr.com/LabelService/EwsLabelService.asmx I used wsimport to create and setup a Java client for connecting

Can&#39;t transparent and undecorated JFrame in JDK7 when enabling nimbus

*爱你&永不变心* 提交于 2019-11-26 15:28:00
Look at this picture : here is the code that transparent's the frame: GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gd = ge.getDefaultScreenDevice(); if (!gd.isWindowTranslucencySupported(TRANSLUCENT)) { System.err.println( "Translucency is not supported"); System.exit(0); } JFrame.setDefaultLookAndFeelDecorated(true); this works good but when trying to enable LookAndFeel by adding try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager

java.nio.file.Path for a classpath resource

ⅰ亾dé卋堺 提交于 2019-11-26 15:16:08
问题 Is there an API to get a classpath resource (e.g. what I'd get from Class.getResource(String)) as a java.nio.file.Path ? Ideally, I'd like to use the fancy new Path APIs with classpath resources. 回答1: This one works for me: return Paths.get(ClassLoader.getSystemResource(resourceName).toURI()); 回答2: Guessing that what you want to do, is call Files.lines(...) on a resource that comes from the classpath - possibly from within a jar. Since Oracle convoluted the notion of when a Path is a Path by

New features in java 7

我们两清 提交于 2019-11-26 14:59:59
问题 What new features in java 7 is going to be implemented? And what are they doing now? 回答1: 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)

Sending email using JSP

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-26 14:56:19
问题 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");

Having spaces in Runtime.getRuntime().exec with 2 executables

天涯浪子 提交于 2019-11-26 14:52:28
问题 I have a command that I need to run in java along these lines: C:\path\that has\spaces\plink -arg1 foo -arg2 bar "path/on/remote/machine/iperf -arg3 hello -arg4 world" This command works fine when the path has no spaces, but when I have the spaces I cannot seems to get it to work. I have tried the following things, running Java 1.7 String[] a = "C:\path\that has\spaces\plink", "-arg1 foo", "-arg2 bar", "path/on/remote/machine/iperf -arg3 hello -arg4 world" Runtime.getRuntime().exec(a); as

Comparison method violates its general contract! Java 7 only

非 Y 不嫁゛ 提交于 2019-11-26 12:25:46
问题 I know this has been an issue for a while now, and checked all previously answers I could get, but still this one doesn\'t work. The object \'crew\' represents crewmembers with ranks and other items. The comparison should be made by comparing \'assigned_rank\', an int value, and if this value is equal in both instances, then \'is_trainer\', a boolean, should make the difference. This method worked great as long as it was running with java < 7. But since Java 7 I keep getting this one: java

Java 7 Automatic Resource Management JDBC (try-with-resources statement)

六月ゝ 毕业季﹏ 提交于 2019-11-26 12:07:01
问题 How to integrate the common JDBC idiom of creating/receiving a connection, querying the database and possibly processing the results with Java 7\'s automatic resource management, the try-with-resources statement? (Tutorial) Before Java 7, the usual pattern was something like this: Connection con = null; PreparedStatement prep = null; try{ con = getConnection(); prep = prep.prepareStatement(\"Update ...\"); ... con.commit(); } catch (SQLException e){ con.rollback(); throw e; } finally{ if

How to install java jdk 7 on Snow Leopard

情到浓时终转凉″ 提交于 2019-11-26 11:59:47
问题 My Mac currently is running Snow Leopard (10.6.8), and I would like to develop with Java 7. I downloaded the Java 7 OS X installer from Oracle\'s website, started to run it. Unfortunately, I was immediately greeted with a message that said the installer is supported only on OS X Lion (10.7.3). Is there any way I can get Java 7 on my machine with Snow Leopard? I am not buying a new OS just to upgrade my Java. I googled around some, but I am not finding much. I\'m hoping I can find some help