How to connect to FTP over TLS/SSL (FTPS) server in Java

The SimpleFTP class/library does not support TLS/SSL at all. Use the FTPSClient class from the Apache Commons Net library instead. See the official example for the FTPClient class and just substitute the FTPClient with the FTPSClient. The FTPSClient class defaults to an explicit TLS/SSL (recommended). In a rare case you need an implicit TLS/SSL, use new FTPSClient(true).

JVM Crash – “EXCEPTION_ACCESS_VIOLATION”

The crash happens inside DirectX library: d3d9.dll. Try the following options: Update / reinstall graphics driver. Switch off graphics card utilities (I’ve noticed RivaTuner in the list of loaded libraries). Run Java with -Dsun.java2d.d3d=false JVM option or set J2D_D3D=false environment variable. This would definitely help, though Java will not make use of Direct3D acceleration.

:: (double colon) operator in Java 8

Usually, one would call the reduce method using Math.max(int, int) as follows: That requires a lot of syntax for just calling Math.max. That’s where lambda expressions come into play. Since Java 8 it is allowed to do the same thing in a much shorter way: How does this work? The java compiler “detects”, that you want to implement a method … Read more

How do I apply the for-each loop to every character in a String?

The easiest way to for-each every char in a String is to use toCharArray(): This gives you the conciseness of for-each construct, but unfortunately String (which is immutable) must perform a defensive copy to generate the char[] (which is mutable), so there is some cost penalty. From the documentation: [toCharArray() returns] a newly allocated character array whose length is the length of this string and whose contents are … Read more

What’s the purpose of META-INF?

Generally speaking, you should not put anything into META-INF yourself. Instead, you should rely upon whatever you use to package up your JAR. This is one of the areas where I think Ant really excels: specifying JAR file manifest attributes. It’s very easy to say something like: At least, I think that’s easy… 🙂 The … Read more

What does -XX:MaxPermSize do?

The permanent space is where the classes, methods, internalized strings, and similar objects used by the VM are stored and never deallocated (hence the name). This Oracle article succinctly presents the working and parameterization of the HotSpot GC and advises you to augment this space if you load many classes (this is typically the case for … Read more

Simple Java HTTPS server

What I eventually used was this: To generate a keystore: See also here. Potentially storepass and keypass might be different, in which case the ks.load and kmf.init must use storepass and keypass, respectively.

Where can i get BigClip? [closed]

The code of BigClip is shown on my answer to this question. It is necessary to compile it for your own use. There is no pre-built Jar you can add to the class-path. (OK, there is a pre-built Jar, but not that I am offering for others to use – brew your own).

How to compare dates in Java?

Date has before and after methods and can be compared to each other as follows: For an inclusive comparison: You could also give Joda-Time a go, but note that: Joda-Time is the de facto standard date and time library for Java prior to Java SE 8. Users are now asked to migrate to java.time (JSR-310). Back-ports are available for Java 6 and 7 as well as Android.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)