为长篇文章道歉,但我想知道在向Sun提交错误报告之前是否可以得到更多建议.
JVM:7u04
操作系统:Windows XP SP3
硬件:奔腾(R)双核E6700 3.20GHz,内存3.25 GB.
浏览:Google Chrome版本19.0.1084.52
当页面加载Applet时,它将一直挂起,直到我关闭它.检查窗口任务管理器,我发现如果杀掉Applet处理器,该页面将不会挂起.我尝试在Applet init()和start()上打印一些消息,但是这些消息没有显示.我只能做的是通过JVM获取完整转储,如下所示.有谁可以告诉我为什么Applet在它开始之前挂起?感谢帮助.
2012-06-07 10:08:25
Full thread dump Java HotSpot(TM) Client VM (23.0-b21 mixed mode, sharing):
"thread applet-com.arcare.extend.ExtendFunc-2" prio=4 tid=0x03021400 nid=0xbe8 in Object.wait() [0x03dad000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x22fa0158> (a sun.plugin2.message.Queue)
at sun.plugin2.message.Queue.waitForMessage(Unknown Source)
- locked <0x22fa0158> (a sun.plugin2.message.Queue)
at sun.plugin2.message.Pipe$2.run(Unknown Source)
at com.sun.deploy.util.Waiter$1.wait(Unknown Source)
at com.sun.deploy.util.Waiter.runAndWait(Unknown Source)
at sun.plugin2.message.Pipe.receive(Unknown Source)
at sun.plugin2.main.client.MessagePassingExecutionContext.doCookieOp(Unknown Source)
at sun.plugin2.main.client.MessagePassingExecutionContext.getCookie(Unknown Source)
at sun.plugin2.main.client.PluginCookieSelector.getCookieFromBrowser(Unknown Source)
at com.sun.deploy.net.cookie.DeployCookieSelector.getCookieInfo(Unknown Source)
at …Run Code Online (Sandbox Code Playgroud) 我在fedora中安装了Java 7,但是当我从命令提示符处尝试javah时,它显示为javah:command not found as javac,java else正在工作.当我在/ usr/bin中搜索时,可执行文件适用于javac,java,javaws但不适用于javah.Javah在Java/JDK/bin文件夹中可见.我怎么能运行javah命令.
Thanx提前.
请任何人帮助我在运行时设置 java 版本路径。
我在不同的目录中安装了两个 java 版本。但是我需要使用 java 7 编译代码来使用 java6 版本执行应用程序。
我需要为 Firefox 浏览器设置 java 6 路径,有人可以帮我吗
提前致谢
我在IBM websphere 8.5.5.2中有Java SDK 6.我在哪里可以在IBM网站上下载Java SDK 7.1并将其更新到websphere.
我试过谷歌,找不到更新Java SDK 7.1所需的信息.我可以从Installation Manager更新它,还是应该从IBM下载任何文件?
我正在使用 java 7 生成一些随机 API 密钥(256 位长),下面提供了两种方法,generate() 和 generate2()。有什么区别吗?如果是这样,哪个更安全/更好?
提前致谢。
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.xml.bind.DatatypeConverter;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
public class RandomAESKeyGen {
public static String generate(final int keyLen) throws NoSuchAlgorithmException {
KeyGenerator keyGen = KeyGenerator.getInstance("AES");
keyGen.init(keyLen);
SecretKey secretKey = keyGen.generateKey();
byte[] encoded = secretKey.getEncoded();
return DatatypeConverter.printHexBinary(encoded).toLowerCase();
}
public static String generate2(final int keyLen) throws NoSuchAlgorithmException {
SecureRandom random = new SecureRandom();
byte bytes[] = new byte[keyLen/8];
random.nextBytes(bytes);
return DatatypeConverter.printHexBinary(bytes).toLowerCase();
}
public static void main(String[] args) {
String key …Run Code Online (Sandbox Code Playgroud) 使用jdk1.7.0_55,我将parseposition.errorIndex设为0,以防时区不是标准的.
但是使用jdk1.6.0_38我得到的parseposition.errorIndex为21,用于相同的错误时区格式
以下是样本:
String date = "13 Jan 2005 21:45:34 ABC";
String format = "dd MMM yyyy HH:mm:ss z";
ParsePosition pp = new ParsePosition(0);
pp.setIndex(0);
SimpleDateFormat sd = new SimpleDateFormat(format,Locale.ENGLISH);
Date d = sd.parse(date,pp);
System.out.println("Error Index "+pp.getErrorIndex());
Run Code Online (Sandbox Code Playgroud)
结果使用jdk 6:
错误索引21
结果使用jdk 7
错误索引0
为什么会有区别?
请帮忙
我正在使用 Eclipse IDE 和 java 7 中的 maven 架构项目开发一个 java 应用程序
我需要生成一个混淆的 jar 文件,该文件还必须包含所有混淆的依赖项我一直在检查一些解决方案,但我一直无法获得所需的结果。
我检查过的一些地方是这样的:
从前两个链接中,我基于我当前的大部分实现
这是我的 pom.xml 文件:
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>modeloconfigurador.cache</groupId>
<artifactId>CacheClienteModelC</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>modeloconfigurador.cache</groupId>
<artifactId>Serializer</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.4</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20140107</version>
</dependency>
<!--<dependency> -->
<!--<groupId>com.pyx4me</groupId> -->
<!--<artifactId>proguard-maven-plugin</artifactId> -->
<!--<version>2.0.4</version> -->
<!-- </dependency> -->
<dependency>
<groupId>net.sf.proguard</groupId>
<artifactId>proguard-base</artifactId>
<version>4.10</version>
</dependency>
</dependencies>
<build>
<finalName>CacheClienteModelC</finalName>
<plugins>
<!-- download source code …Run Code Online (Sandbox Code Playgroud) 我有一个单元测试的项目在Java 7下运行,但不在Java 8下.有没有一种很好的方法来调查这些东西?(我确信测试是正确的;这表明实现中存在一个微妙的错误.)
真的,我想我想要的是一种快速识别代码路径分歧的方法.但这很难,因为通过JDK在代码路径中可能存在非常低级别的各种差异,并且我不希望陷入无关紧要的差异,这些差异归结为微小的优化.
所以,好的方法可能是询问路径偏离的顶级跟踪; 然后,从那一点开始,询问在哪个二级跟踪路径发散; 等等.
但我不知道是否有办法做到这一点.如果我没有系统的方法,我担心我会浪费很多时间.
顺便说一句,代码是Apache Phoenix存储库,在Java 8下,我遇到以下故障:
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.006 sec <<< FAILURE! - in org.apache.phoenix.schema.PMetaDataImplTest
testEviction(org.apache.phoenix.schema.PMetaDataImplTest) Time elapsed: 0.006 sec <<< FAILURE!
java.lang.AssertionError: expected:<3> but was:<2>
at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.failNotEquals(Assert.java:834)
at org.junit.Assert.assertEquals(Assert.java:645)
at org.junit.Assert.assertEquals(Assert.java:631)
at org.apache.phoenix.schema.PMetaDataImplTest.testEviction(PMetaDataImplTest.java:98)
Run Code Online (Sandbox Code Playgroud) 我正在使用 Spring、Maven 和 Java 7 开发一个项目。
我有一个带有 bigdecimal 的列表,并且必须总结列表中的所有元素。我知道使用 for 循环我们可以如下,
List<BigDecimal> list = new ArrayList<BigDecimal>();
list.add(new BigDecimal(10.333));
list.add(new BigDecimal(14.333));
BigDecimal result = new BigDecimal(0);
for (BigDecimal b : list) {
result = result.add(b);
}
Run Code Online (Sandbox Code Playgroud)
有没有更好的办法?使用 google gauva FluentIterable 或 apache ArrayUtils/StatUtils?
我正在尝试使用VisualVM来配置我的程序,但它总是崩溃,通常会出现相同的错误消息:
Waiting...
Profiler Agent: Waiting for connection on port 5140 (Protocol version: 15)
Profiler Agent: Established connection with the tool
Profiler Agent: Local accelerated session
Starting test 0
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00000000c12e9d20, pid=4808, tid=11472
#
# JRE version: Java(TM) SE Runtime Environment (8.0_31-b13) (build 1.8.0_31-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.31-b07 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C 0x00000000c12e9d20 …Run Code Online (Sandbox Code Playgroud)