Java Decompiler

你能为Eclipse推荐一个Java反编译器吗? 我的其他问题是使用来自其他Java程序的反编译代码有什么限制? 非法还是什么? 我不太了解许可证。 谢谢阅读。

为什么Maven会产生这个错误:“……在源代码1.5中不支持”?

今天早上Maven开始抱怨这个错误: error: multi-catch statement is not supported in -source 1.5 奇怪的是,我正在使用JDK 7,这段代码已经好几周了。 我只是使用m2e和默认的POM,没有指定编译器版本。 这是我的Maven版本信息: Apache Maven 3.0.2 (r1056850; 2011-01-08 19:58:10-0500) Java version: 1.7.0_03, vendor: Oracle Corporation Java home: C:\SDKs\Java\jdk1.7.0_03\jre Default locale: en_US, platform encoding: Cp1252 OS name: “windows 7”, version: “6.1”, arch: “amd64”, family: “windows” 我可以通过使用Maven编译器插件来解决它: org.apache.maven.plugins maven-compiler-plugin 2.4 1.7 1.7 不过,我想了解为什么Maven会突然开始行为不端并要求使用编译器插件。

如何确定类是否在Java中扩展另一个类?

在Java中,我该如何确定类扩展了哪些类? public class A{ } public class B extends A{ } public class C extends A{ } public class D{ } public class E extends B{ } public class doSomething{ public void myFunc(Class cls){ //need to check that cls is a class which extends A //ie B, C and E but not A or D […]

结合两份Jasper报告

我有一个带有下拉列表的Web应用程序,用户可以从中选择报告类型。 report1,report2,report3等 根据所选报告,在服务器上编译Jasper报告,并以PDF格式弹出。 在服务器端,我使用下面的代码以单独的方法实现每个报告,例如对于report1: JRBeanCollectionDataSource report1DataSource = new JRBeanCollectionDataSource(resultSetBeanListReport1); InputStream inputStreamReport1 = new FileInputStream(request.getSession().getServletContext ().getRealPath(jrxmlFilePath + “report1.jrxml”)); JasperDesign jasperDesignReport1 = JRXmlLoader.load(inputStreamReport1); JasperReport jasperReportReport1 = JasperCompileManager.compileReport(jasperDesignReport1); bytes = JasperRunManager.runReportToPdf(jasperReportReport1, titleMapReport1, report1DataSource); 同样,report2使用以下代码的单独方法: JRBeanCollectionDataSource invstSummDataSource = new JRBeanCollectionDataSource(resultSetBeanListInvstOfSumm); InputStream inputStreamInvstSumm = new FileInputStream(request.getSession().getServletContext().getRealPath(jrxmlFilePath + “investSummary.jrxml”)); JasperDesign jasperDesignInvstSumm = JRXmlLoader.load(inputStreamInvstSumm); JasperReport jasperReportInvstSumm = JasperCompileManager.compileReport(jasperDesignInvstSumm); bytes = JasperRunManager.runReportToPdf(jasperReportInvstSumm, titleMapInvstSumm, […]

Java正则表达式错误 – 后瞻组没有明显的最大长度

我收到此错误: java.util.regex.PatternSyntaxException: Look-behind group does not have an obvious maximum length near index 22 ([az])(?!.*\1)(?<!\1.+)([az])(?!.*\2)(?<!\2.+)(.)(\3)(.)(\5) ^ 我想要匹配COFFEE ,但不是BOBBEE 。 我正在使用java 1.6。

在Struts 2中绑定后更改参数

我有一个从用户接收一些参数的动作(例如日期)。 此操作会生成许多不同的报告,因此它有许多不同的方法。 我需要在每个方法之前调整这些参数(将时间设置为午夜)。 在绑定参数之前执行prepare方法。 是否有其他拦截器或任何其他允许我这样做的约定?

获取javax.crypto.IllegalBlockSizeException:使用填充密码解密时,输入长度必须是16的倍数?

使用tomcat,我有两个web应用程序,即app1和app2。 我将app1以加密forms(使用下面的代码)发送到app2。 然后在app2我解密了这个加密的url。 但是我在decryp方法的第50行遇到了exception。 “Getting javax.crypto.IllegalBlockSizeException: Input length must be multiple of 16 when decrypting with padded cipher” 虽然我尝试在app1解密(使用相同的代码)加密的URL时进行调试,但它工作正常。 但无法弄清楚在app2引起此exception的原因是什么? 这是代码 import java.security.Key; import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; import sun.misc.BASE64Decoder; import sun.misc.BASE64Encoder; public class AESEncryptionDecryptionTest { private static final String ALGORITHM = “AES”; private static final String myEncryptionKey = “ThisIsFoundation”; private static final String UNICODE_FORMAT = […]

因为类加载器而导致ClassCastException?

在使用类加载器时,我遇到以下exception: Exception in thread “main” java.lang.ClassCastException: xxx.Singleton cannot be cast to xxx.Singleton 这是否意味着类加载器中的实例不能转换为另一个类加载器的类? 检查我的代码,我可以通过类加载器实现3个单例,即使是“”安全性。 public static void main(String[] args) throws Exception { URL basePath = new URL(“file:/myMavenPath/target/classes/”); Object instance = getClassInstance(Singleton.class); System.out.println(instance); // Object instance2 = getClassInstance( new URLClassLoader( new URL[]{basePath} , null ) .loadClass(“my.Singleton”) ); System.out.println(instance2); // Object instance3 = getClassInstance( new URLClassLoader( new […]

List 和List ?

我有一个关于Javagenerics的非常基本的问题。 我认为List和List List是同质的。 我是对的还是有一些我缺少的基础?

如何重用HttpUrlConnection?

我有兴趣重用一个HttpUrlConnection(作为我正在开发的服务器和客户端之间的状态协议的一部分)。 我知道持久性http有一个Connection = keep-alive标头。 现在,我想知道如何重用这样一个问题。 我写了这段代码: URL u = new java.net.URL(“http://localhost:8080/Abc/Def”); HttpURLConnection c = (HttpURLConnection) u.openConnection(); c.setRequestMethod(“GET”); c.setRequestProperty(“Connection”, “keep-alive”); c.setHeader(“A”,”B”); c.getInputStream() //here I see that server gets my messages (using DEBUG) c.setHeader(“B”,”C”); // 现在我如何重新发送这个“B”标头到服务器,我尝试重新连接等,但没有任何东西让它工作。 并且服务器还执行response.setHeader(“Connection”, “keep-alive”); 我看过许多论坛,但没有人写过这个。 也许HttpURLConnection不处理这个?