我的Ubuntu机器上的Eclipse有一个小问题.我安装了JDK,设置了JAVA_HOME和PATH变量,一切似乎都正确,但是eclipse拒绝启动并抛出错误:
必须提供Java运行时环境(JRE)或Java Development Kit(JDK)才能运行Eclipse.搜索以下位置后未找到Java虚拟机:/ opt/eclipse/jre/bin/java java当前PATH
不知道问题是什么.请帮忙.
注意:
我能够在终端中运行java和javac.
我使用@XmlID和@XmlIDREF标记来引用另一个对象.即使使用继承的类,它在Java 6中也能正常工作.我创建的示例代码如下所示.基类使用的标签:
@XmlRootElement
@XmlAccessorType(FIELD)
public class Module {
Module() {}
@XmlIDREF
private Module other;
@XmlID
private String id;
public Module(String id, Module other) {
this.id = id;
this.other = other;
}
}
Run Code Online (Sandbox Code Playgroud)
继承类:
@XmlRootElement
public class TheModule extends Module {
TheModule() {}
private String feature;
public TheModule(String id, Module other, String feature) {
super(id, other);
this.feature = feature;
}
}
Run Code Online (Sandbox Code Playgroud)
这些类的容器:
@XmlRootElement
public class Script {
Script() {}
public Script(Collection<Module> modules) {
this.modules = modules;
}
@XmlElementWrapper
@XmlElementRef
Collection<Module> modules …Run Code Online (Sandbox Code Playgroud) 当我使用wsgen或apt在JDK 7中使用命令生成Web服务工件时.
wsgen -s src -cp CLASS_PATH -d OUTPUT_DIRECTORY com.sun.WebServiceSEI
Run Code Online (Sandbox Code Playgroud)
显示以下警告消息
自JDK 7以来,com.sun.mirror包中包含的apt工具及其关联的API已被弃用,并计划在下一个主要JDK版本中删除.使用javac工具中提供的选项以及包javax.annotation.processing和javax.lang.model中包含的API来处理注释.
如何在不使用wsgen或apt删除此警告的情况下生成Web服务工件?
我们在java 7中有一个类,需要从本机代码加载它.我已经使用java 6和JNI但java 6无法加载该类.所以我在我的VC项目中安装了新的JDK,更改了包含目录和链接引用等等.直到我想从JNI启动jre7:
JNI_CreateJavaVM采用vm_args.version参数中的java版本,但没有比1.6更新版本的定义.
JavaVMInitArgs vm_args;
...
vm_args.version = JNI_VERSION_1_6;
vm_args.nOptions = 2;
vm_args.options = options;
vm_args.ignoreUnrecognized = 0;
int ret = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
Run Code Online (Sandbox Code Playgroud)
调用FindClassjava7类显然会产生UnsupportedClassVersionError.
问题:我如何创建一个java7 JVM JNI_CreateJavaVM?
java7有问题吗?我正在使用Collections.sort(列表,比较器)
当我切换到java7时,我注意到与我使用java6时的结果相比,排序产生了不同的列表.
示例:List = [d,e,b,a,c,f,g,h]
在java6 Collections.sort(List,comparator)中产生[a,b,c,d,e,f,g,h]
在java7 Collections.sort(List,comparator)中产生[b,a,c,d,e,f,g,h]
列表中的前两个值已被交换.
我有一个干净的Debian挤压安装,并试图让一个jar应用程序运行,将与USB端口中的蓝牙加密狗通信.硬件方面都在这里运行精细的蓝牙功能.我需要运行我安装的Java7,从oracle下载jdk并使用update-alternatives将其绑定到系统中.
Java应用程序需要bluecove作为库与系统进行通信.我的bluecove.jar文件在我的classpath/home/app/lib中我有gpl,还有正常的快照.
当我通过我执行应用程序时,java -cp /home/app/lib/bluecove-2.1.1-SNAPSHOT.jar -jar myapp.jar我一遍又一遍地得到同样的错误,无法弄明白.它像java一样无法加载bluecove.
Exception in thread "main" javax.bluetooth.BluetoothStateException: BlueCove com.intel.bluetooth.BluetoothStackBlueZ|com.intel.bluetooth.BluetoothStackBlueZDBus not available
at com.intel.bluetooth.BlueCoveImpl.loadStackClass(BlueCoveImpl.java:356)
at com.intel.bluetooth.BlueCoveImpl.detectStack(BlueCoveImpl.java:447)
at com.intel.bluetooth.BlueCoveImpl.access$500(BlueCoveImpl.java:69)
at com.intel.bluetooth.BlueCoveImpl$1.run(BlueCoveImpl.java:1044)
Run Code Online (Sandbox Code Playgroud)
谁见过这个?谢谢!
我正在尝试在Windows 7计算机上安装JDK 7,并且无论我选择何种安装路径,都会不断收到错误"在所选路径中找到分号".
试过不同的JDK更新,它也没有帮助.
编辑:安装日志显示以下错误:
Thu May 05 06:34:19 2016 :: JDK安装失败.返回代码:1603,ErrorCode:0
我正在审查github上的HikariCP项目,它声明它支持"Java 7和Java 8 maven artifact",在其源代码中,它使用了一些Java 8特性:
java.util.function.Consumer;
java.util.function.Predicate;
java.util.function.UnaryOperator;
Run Code Online (Sandbox Code Playgroud)
我想如果其他人使用Java 7引用此项目,则会发生错误.那么,该项目如何使其同时支持Java 7和Java 8?
当前,我们使用以下框架开发了jersey 2.0 restful应用程序:
该应用程序可在tomcat 8.5&Weblogic 12.1.x服务器上完美运行
但是,当我们尝试将其部署到 Weblogic 12.2.1.3
<Oct 6, 2017 10:32:23,020 AM HKT> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID "214569275552728" for task "1" on [partition-name: DOMAIN]. Error is: "weblogic.application.ModuleException: org.glassfish.jersey.internal.ServiceConfigurationError: org.glassfish.jersey.server.spi.ComponentProvider: The class org.glassfish.jersey.ext.cdi1x.internal.CdiComponentProvider implementing the provider interface org.glassfish.jersey.server.spi.ComponentProvider is not found. The provider implementation is ignored."
weblogic.application.ModuleException: org.glassfish.jersey.internal.ServiceConfigurationError: org.glassfish.jersey.server.spi.ComponentProvider: The class org.glassfish.jersey.ext.cdi1x.internal.CdiComponentProvider implementing the provider interface org.glassfish.jersey.server.spi.ComponentProvider is not found. The provider implementation …Run Code Online (Sandbox Code Playgroud) 某些使用新字符串的字节数组(字节[],“ UTF-8”)在jdk 1.7和1.8中返回不同的结果
byte[] bytes1 = {55, 93, 97, -13, 4, 8, 29, 26, -68, -4, -26, -94, -37, 32, -41, 88};
String str1 = new String(bytes1,"UTF-8");
System.out.println(str1.length());
byte[] out1 = str1.getBytes("UTF-8");
System.out.println(out1.length);
System.out.println(Arrays.toString(out1));
byte[] bytes2 = {65, -103, -103, 73, 32, 68, 49, 73, -1, -30, -1, -103, -92, 11, -32, -30};
String str2 = new String(bytes2,"UTF-8");
System.out.println(str2.length());
byte[] out2 = str2.getBytes("UTF-8");
System.out.println(out2.length);
System.out.println(Arrays.toString(out2));
Run Code Online (Sandbox Code Playgroud)
bytes2使用新的String(byte [],“ UTF-8”),结果(str2)在jdk7和jdk8中不相同,但byte1相同。bytes2有什么特别之处?
测试“ ISO-8859-1”代码,bytes2的结果与jdk1.8中的相同!
jdk1.7.0_80:
15
27
[55, 93, 97, -17, -65, -67, 4, …Run Code Online (Sandbox Code Playgroud)