Java nested generic type mismatch

If you want to be able to call fourth with a List<List<String>> argument, then you’ll need to change your signature to this: private static void fourth(List<? extends List<?>> a){ System.out.println(“List of a List of anything “); } The above will work because unlike List<List<?>>, List<? extends List<?>> is compatible with List<List<String>>. Think of it this … Read more

UnsupportedClassVersionError: JVMCFRE003 bad major version in WebSphere AS 7

WebSphere Application Server V7 does support Java Platform, Standard Edition (Java SE) 6 (see Specifications and API documentation in the Network Deployment (All operating systems), Version 7.0 Information Center) and it’s since the release V8.5 when Java 7 has been supported. I couldn’t find the Java 6 SDK documentation, and could only consult IBM JVM … Read more

WatchService for Java 6 [closed]

yes, of course. Apache VFS does exactly this. you can find it under http://commons.apache.org/vfs/. It’s a pure java library that can monitor files and it’s pretty easy to use: FileSystemManager manager = VFS.getManager(); FileObject file= manager.resolveFile(“c:/MyFile.txt”); DefaultFileMonitor fm = new DefaultFileMonitor(new MyListener()); fm.setDelay(5000); fm.addFile(file); fm.start(); the code above will monitor the file c:/MyFile.txt. if it … Read more

Simple Java HTTPS server

What I eventually used was this: try { // Set up the socket address InetSocketAddress address = new InetSocketAddress(InetAddress.getLocalHost(), config.getHttpsPort()); // Initialise the HTTPS server HttpsServer httpsServer = HttpsServer.create(address, 0); SSLContext sslContext = SSLContext.getInstance(“TLS”); // Initialise the keystore char[] password = “simulator”.toCharArray(); KeyStore ks = KeyStore.getInstance(“JKS”); FileInputStream fis = new FileInputStream(“lig.keystore”); ks.load(fis, password); // Set … Read more

Generic support for ISO 8601 format in Java 6

Seems that you can use this: import java.util.Calendar; import javax.xml.bind.DatatypeConverter; public class TestISO8601 { public static void main(String[] args) { parse(“2012-10-01T19:30:00+02:00”); // UTC+2 parse(“2012-10-01T19:30:00Z”); // UTC parse(“2012-10-01T19:30:00”); // Local } public static Date parse(final String str) { Calendar c = DatatypeConverter.parseDateTime(str); System.out.println(str + “\t” + (c.getTime().getTime()/1000)); return c.getTime(); } }