rt.jar

InetAddress java 8 is not getting the hostname

送分小仙女□ 提交于 2019-12-30 10:07:50
问题 InetAddress.getLocalHost().getHostName() is no more getting the name of the HostName since I switched to java 8 ... with the jdk1.8 the InetAddress.getLocalHost().getHostName() returns "localhost". Before (when I was using jdk1.6) it gives me the right hostname (which is "ACTION03") according to the network config : cat /etc/sysconfig/network NETWORKING=yes HOSTNAME=ACTION03 any help ? 回答1: Works for me on Linux (Ubuntu 14.04) with Java 1.8.0_05. public class HostName { public static void

InetAddress java 8 is not getting the hostname

会有一股神秘感。 提交于 2019-12-30 10:07:13
问题 InetAddress.getLocalHost().getHostName() is no more getting the name of the HostName since I switched to java 8 ... with the jdk1.8 the InetAddress.getLocalHost().getHostName() returns "localhost". Before (when I was using jdk1.6) it gives me the right hostname (which is "ACTION03") according to the network config : cat /etc/sysconfig/network NETWORKING=yes HOSTNAME=ACTION03 any help ? 回答1: Works for me on Linux (Ubuntu 14.04) with Java 1.8.0_05. public class HostName { public static void

Java IDE中Access restriction错误的修订

不羁的心 提交于 2019-12-07 12:22:48
今天在eclipse mars中导入一个外部项目,在编译时出现了下面的错误: Access restriction: The type 'BASE64Encoder' is not API (restriction on required library 'C:\Program Files\Java\jre1.8.0_20\lib\rt.jar') 出现这个错误,是因为调用了Eclipse或MyEclipse自带的jre运行库,访问“rt.jar”的会出现“访问限制” 解决方法有两种: 1.不调用Eclipse等集成环境自带的jre,替换成自己安装的JDK就可以了。 如下图: 2.Eclipse 默认把这些受访问限制的API设成了ERROR。找到eclipse的Window下拉菜单,Preferences -> Java -> Complicer -> Errors/Warnings,将里面的Deprecated and restricted API中的Forbidden references(access rules)选为Warning就可以编译通过。 如下图: 来源: oschina 链接: https://my.oschina.net/u/75789/blog/547908

InetAddress java 8 is not getting the hostname

爷,独闯天下 提交于 2019-12-01 06:51:14
InetAddress.getLocalHost().getHostName() is no more getting the name of the HostName since I switched to java 8 ... with the jdk1.8 the InetAddress.getLocalHost().getHostName() returns "localhost". Before (when I was using jdk1.6) it gives me the right hostname (which is "ACTION03") according to the network config : cat /etc/sysconfig/network NETWORKING=yes HOSTNAME=ACTION03 any help ? Works for me on Linux (Ubuntu 14.04) with Java 1.8.0_05. public class HostName { public static void main(String[] args) throws Exception { System.out.println(java.net.InetAddress.getLocalHost().getHostName()); }