java-7

Exception thrown when building EAR after switching to JDK 7

∥☆過路亽.° 提交于 2019-12-11 03:47:17
问题 i'm trying to port my application to JDK 7 from JDK 6 and its giving this exception when i'm trying to build the project in Netbeans IDE. Error starting Sun's native2ascii: at org.apache.tools.ant.taskdefs.optional.native2ascii.SunNative2Ascii.run(SunNative2Ascii.java:67) at org.apache.tools.ant.taskdefs.optional.native2ascii.DefaultNative2Ascii.convert(DefaultNative2Ascii.java:54) at org.apache.tools.ant.taskdefs.optional.Native2Ascii.convert(Native2Ascii.java:268) at org.apache.tools.ant

Can't install JDK 7

烈酒焚心 提交于 2019-12-11 03:10:51
问题 I can install the JRE 7 without any problem. However when I try to install JDK 7, nothing happens. I am currently running Win7 64-bit. When I double click on the downloaded file, a dialog box pops up asking me if I want to run the application, I click "run" and then nothing happens. I don't even get an error message. JDK 6 installs just fine. I tried uninstalling all versions of Java, and the installing JDK 7, but the same thing happens. I've even installed JDK 7 on another computer just fine

SimpleDateFormat parse returns wrong value

最后都变了- 提交于 2019-12-11 02:47:59
问题 I have this code: public static String formatMinSecOrHourMinSec(final String length) { try { final SimpleDateFormat hhmmss = new SimpleDateFormat("HH:mm:ss", Locale.GERMAN); final Date date = hhmmss.parse(length); final GregorianCalendar gc0 = new GregorianCalendar(Locale.GERMAN); gc0.setTime(date); if(gc0.getTimeInMillis() >= 3600 * 1000){ return hhmmss.format(gc0.getTime()); }else{ final SimpleDateFormat mmss = new SimpleDateFormat("mm:ss"); return mmss.format(gc0.getTime()); } } catch

How to get the canonical name of a hostname in Java?

余生颓废 提交于 2019-12-11 01:52:15
问题 I have build a small helper class for DNS resolving: public class DNSService { private static Properties env; private static final String CNAME_ATTRIB = "CNAME"; private static String[] CNAME_ATTRIBS = { CNAME_ATTRIB }; static { env = new Properties(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.dns.DnsContextFactory"); } public static String getCNAME(String host) throws NamingException { return getCNAME(new InitialDirContext(env), host); } private static String getCNAME

WatchService Api file watching throws exception when try access file in created event occur

梦想的初衷 提交于 2019-12-11 01:08:30
问题 i have code below to tracking file changes on a dedicate folder Path path = Paths.get("f:\\logs"); WatchService watchService = FileSystems.getDefault().newWatchService(); WatchKey key = path.register(watchService, StandardWatchEventKinds.ENTRY_CREATE); while (true) { final WatchKey watchKey = watchService.take(); for (WatchEvent<?> watchEvent : key.pollEvents()) { WatchEvent.Kind<?> kind = watchEvent.kind(); if (kind == StandardWatchEventKinds.ENTRY_CREATE) { WatchEvent<Path> eventPath =

Glassfish - java.lang.NoClassDefFoundError

我的未来我决定 提交于 2019-12-11 00:52:53
问题 I was following this blog to run a sample websocket application in glasshfish. The deployment failed with the following error. But the mentioned class file is available in the pom.xml and it is listed in the dependencies as well. Could you please help? Error occurred during deployment: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.NoClassDefFoundError: org/glassfish/websocket/spi/Endpoint.

Using IntelliJ to compile Java 7, configuration trouble

女生的网名这么多〃 提交于 2019-12-11 00:08:31
问题 I am playing with IntelliJ and trying to get it to work with Java 7. My JDK is set up to point to latest JDK Additionally, project is set to use it as well Yet, when trying to write Java7 code, it's syntax is not being recognized. What am i missing please? 回答1: Set the Project Language Level to 7.0 . Reload the project when asked: 来源: https://stackoverflow.com/questions/12699321/using-intellij-to-compile-java-7-configuration-trouble

JBoss AS 7 upgrade to Java 7, JBoss VFS

家住魔仙堡 提交于 2019-12-10 23:50:03
问题 We have an spring application which dynamically loads components based in the lib folder. This application needs to be deployed on different AS, like Jetty,Tomcat,JBoss.. Now, JBoss has this VFS feature, where it does not really unpack your war it seems, and uses vfs:// for files inside the war/jar.. Currently we are in the process of upgrading (from Java6) to Java7, and we encounter the following problem. First of all, snowdrop 1.0.0GA no longer works under Java7, because the InputStream was

How to move file(s)/dir to recycle bin in Java instead of deleting it permanently [duplicate]

£可爱£侵袭症+ 提交于 2019-12-10 23:03:49
问题 This question already has answers here : Is it possible with Java to delete to the Recycle Bin? (9 answers) Does Java 7 have a way to put files in recycle bin rather than delete on Windows (1 answer) Closed 2 years ago . I am trying to create example of GUI that's delete files and/or directories When user clicks on Button, but I see that files deleted permanently, How to make it moves to recycle bin instead of this if (File_path.getText().isEmpty()) { JOptionPane.showMessageDialog(null,

JENKINS: ERROR when I try to use an older JDK for a specific maven project

怎甘沉沦 提交于 2019-12-10 22:23:56
问题 I am using the Jenkins version 2.73-1.1 on a CentOS Linux release 7.3.1611 server. There are 3 different versions of JDK on the server: [root @ jenkins java] # ll total 12 lrwxrwxrwx. 1 root root 16 27 Apr 16.25 default -> / usr / java / latest drwxr-xr-x. 8 root root 4096 27 Mar 2013 jdk1.6.0_45 drwxr-xr-x. Root root 4096 11 Apr 2015 jdk1.7.0_80 drwxr-xr-x. 9 root root 4096 27 Apr 16.25 jdk1.8.0_131 lrwxrwxrwx. 1 root root 22 27 apr 16.25 latest -> /usr/java/jdk1.8.0_131 As shown in the