2019-03-21

javax.mail.MessagingException: Could not convert socket to TLS;


https://stackoverflow.com/questions/16115453/javamail-could-not-convert-socket-to-tls-gmail

javax.mail.MessagingException: Could not convert socket to TLS;

Solved by: props.put("mail.smtp.ssl.trust", "smtp.gmail.com");


openjdk.java.net vs jdk.java.net



edited 6 months ago from 2019-Mar-21_pm034301


Note that while both openjdk.java.net (the OpenJDK project) and jdk.java.net (OpenJDK builds by Oracle) are run by Oracle, jdk.java.net is not an OpenJDK website.











OpenJDK vs AdoptOpenJDK


Updates@2019-Apr-01_pm040305:

I'm using OpenJDK8U-jdk_x64_linux_hotspot_8u202b08
https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u202-b08/OpenJDK8U-jdk_x64_linux_hotspot_8u202b08.tar.gz

from: https://adoptopenjdk.net/releases.html?variant=openjdk8&jvmVariant=hotspot#x64_linux



Seems previous finding

https://billson.blogspot.com/2019/03/openjdk-variants-vs-each-other-and-vs.html


  1. OracleJDK
  2. OpenJDK
    1. from Oracle
    2. from other providers




jdk_ri-8u40-b25-windows-i586-10_feb_2015>bin\java.exe -version
openjdk version "1.8.0_40"
OpenJDK Runtime Environment (build 1.8.0_40-b25)
OpenJDK Client VM (build 25.40-b25, mixed mode)

OpenJDK8U-jre_x86-32_windows_hotspot_8u202b08\bin\java.exe -version
openjdk version "1.8.0_202"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_202-b08)
OpenJDK Server VM (AdoptOpenJDK)(build 25.202-b08, mixed mode)




Reference from stackoverflow
Difference between OpenJDK and AdoptOpenJDK
https://stackoverflow.com/questions/52431764/difference-between-openjdk-and-adoptopenjdk


In short:
  • OpenJDK has multiple meanings and can be referred as:
    • free and open source implementation of the Java Platform, Standard Edition (Java SE)
    • open source repository - the Java source code aka OpenJDK project
    • prebuilt OpenJDK binaries provided by Oracle
  • AdoptOpenJDK prebuilt OpenJDK binaries provided by community



    Explanation:
    Prebuilt OpenJDK (or distribution) - binaries, built from http://hg.openjdk.java.net/, provided in a zip or installer, offered for various platforms, with a possible support contract.
    OpenJDK, the source repository (also called OpenJDK project) - is a Mercurial-based open source repository, hosted at [http://hg.openjdk.java.net]. The Java source code. The vast majority of Java features (from the VM and the core libraries to the compiler) are based solely on this source repository. Oracle have an alternate fork of this.
    OpenJDK, the distribution (see the list of providers below) - is free as in beer and kind of free as in speech, but, you do not get to call Oracle if you have problems with it. There is no support contract. Furthermore, Oracle will only release updates to any OpenJDK (the distribution) version if that release is the most recent Java release (including LTS). The day oracle releases OpenJDK (the distribution) version 12.0, even if there's a security issue with OpenJDK (the distribution) version 11.0, Oracle shall not release an update for 11.0. Maintained solely by Oracle.
    AdoptOpenJDK, the distribution - very similar to Oracle's OpenJDK distribution (in that it is free, and it is a build produced by compiling the sources from the OpenJDK source repository). AdoptOpenJDK as an entity will not be backporting patches, i.e. there won't be an AdoptOpenJDK 'fork/version' that is materially different from upstream (except for some build script patches for things like Win32 support). Meaning, if members of the community (Oracle or others, but not AdoptOpenJDK as an entity) backport security fixes to updates of OpenJDK LTS versions, then AdoptOpenJDK will provide builds for those. Maintained by OpenJDK community.
    There's also OracleJDK - another distribution, starting with JDK12 there will be no free version of this. Oracle's JDK distribution offering intended for commercial support. You pay for this, but then you do get to rely on Oracle for support. Unlike Oracle's OpenJDK offering, the OracleJDK offering does come with longer support for LTS versions. As a developer you can get a free license for personal/development use only of this particular JDK, but that's mostly a red herring, as 'just the binary' is basically the same as the OpenJDK binary. I guess it means you can download security-patched versions of LTS JDKs from Oracle's websites as long as you promise not to use them commercially.
    Note. It maybe best to call the OpenJDK builds by Oracle, the "Oracle OpenJDK builds".
    Donald Smith, Java product manager at Oracle writes:
    Ideally, we would simply refer to all Oracle JDK builds as the "Oracle JDK," either under the GPL or the commercial license depending on your situation. However, for historical reasons while the small remaining differences exist, we will refer to them separately as Oracle’s OpenJDK builds, and the Oracle JDK.

    OpenJDK Providers and Comparison

    ---------------------------------------------------------------------------
    |     Provider      | Free Builds | Free Binary   | Extended | Commercial |
    |                   | from Source | Distributions | Updates* | Support    |  
    |-------------------------------------------------------------------------|               
    | AdoptOpenJDK      |    Yes      |    Yes        |   Yes    |   No       |
    | Azul              |    No       |    Yes        |   Yes    |   Yes      |
    | IBM               |    No       |    No         |   Yes    |   Yes      |
    | Mercurial         |    Yes      |    Yes        |   No     |   No       |
    | Oracle            |    No       |    Yes        |   No**   |   Yes      |
    | RedHat            |    Yes      |    Yes        |   Yes    |   Yes      |
    | SapMachine        |    Yes      |    Yes        |   Yes    |   Yes      |
    | Amazon – Corretto |    Yes      |    Yes        |   Yes    |   No       |
    ---------------------------------------------------------------------------
    
    * Extended Updates - Public Updates beyond the 6-month release lifecycle
    ** Oracle provides extended updates (and support) to paying customers, i.e. Oracle JDK only

    Additional information
    Time to look beyond Oracle's JDK by Stephen Colebourne
    Java Is Still Free by Java Champions community (published on September 17, 2018)
    Java is Still Free 2.0.0 by Java Champions community (published on March 3, 2019)






2019-03-19

WinSCP configure hostkey in winscp script


What's WinSCP hostkey


Before OpenSSH 6.8
 ssh-keygen -lf <(ssh-keyscan localhost 2>/dev/null)



Since OpenSSH 6.8, you have to add the -E md5 switch to get the format needed for WinSCP.

ssh-keygen -E md5 -lf <(ssh-keyscan localhost 2>/dev/null)


[billson@169 ~]$ ssh-keygen -E md5 -lf <(ssh-keyscan localhost 2>/dev/null)
2048 MD5:aa:bb:cc:xx:xx:xx:xx:43:79:ae:90:ca:83:d3:xx:ef localhost (RSA)
256 MD5:xx:81:xx:7a:xx:49:68:87:xx:a3:54:xx:61:b3:xx:15 localhost (ECDSA)
256 MD5:xx:69:29:4a:xx:f0:8f:74:xx:5d:1b:86:aa:xx:d7:1b localhost (ED25519)



USING (RSA)
GET CONTENT BETTWEN [MD5:]*********************[localhost (RSA)] without space
SUPPOSE also using 2048


Replace
open sftp://user:password@example.com/ -hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx..."
to:
open sftp://user:password@example.com/ -hostkey="ssh-rsa 2048 aa:bb:cc:xx:xx:xx:xx:43:79:ae:90:ca:83:d3:xx:ef"




2019-03-18

tar gzip with or without GZIP=-9



target folder name: 2019_02
target folder size: 1.3G




tar -cvzf 2019_02.default.tgz 2019_02
Compressed: 318M 2019_02.default.tgz



GZIP=-9 tar -cvzf 2019_02.GZIP=-9.tgz 2019_02
Compressed: 310M 2019_02.GZIP=-9.tgz



linux find files older than 365 days exclude multiple paths


Navigate to target folder, search sub folders and sort files details older than 365 days with folder exclusion config below:

find . -type d \( -path "./Programs/jdk1.7.xxx" -o -path "./Programs/apache-tomcat-7.0.xxx" -o -path "./Programs/mysql-xxx" \) -prune -o -mtime +365 | sort

Similar as above, but ls -lrth

find . -type d \( -path "./Programs/jdk1.7.xxx" -o -path "./Programs/apache-tomcat-7.0.xxx" -o -path "./Programs/mysql-xxx" \) -prune -o -mtime +365 -exec ls -lrth {} \;




Google'ed: linux find exclude directory






Reference URL: https://stackoverflow.com/questions/4210042/how-to-exclude-a-directory-in-find-command






Use the prune switch, for example if you want to exclude the misc directory just add a -path ./misc -prune -o to your find command:
find . -path ./misc -prune -o -name '*.txt' -print
Here is an example with multiple directories:
find . -type d \( -path dir1 -o -path dir2 -o -path dir3 \) -prune -o -print
Here we exclude dir1, dir2 and dir3, since in find expressions it is an action, that acts on the criteria -path dir1 -o -path dir2 -o -path dir3 (if dir1 or dir2 or dir3), ANDed with type -d. Further action is -o print, just print.














Google Referrals