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
- OracleJDK
- OpenJDK
- from Oracle
- 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
- AdoptOpenJDK - https://adoptopenjdk.net
- Azul - https://www.azul.com
- IBM - https://www.ibm.com/developerworks/java/jdk
- Mercurial - https://hg.openjdk.java.net
- Oracle - http://jdk.java.net
- RedHat - https://developers.redhat.com/products/openjdk/overview
- SapMachine - https://sap.github.io/SapMachine
- Amazon – Corretto - https://aws.amazon.com/corretto
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.2019-03-15
OpenJDK variants vs each other and vs Oracle JDK
Reference URL: https://medium.com/@javachampions/java-is-still-free-c02aef8c9e04
OpenJDK variants vs each other and vs Oracle JDK
Seems we have:
- OracleJDK
- OpenJDK
- from Oracle
- from other providers
Reference:
Q. Differences between OpenJDK vs Oracle’s OpenJDK builds vs Oracle JDK?
We’ll just talk about Java 11+ LTS releases here. Oracle JDK and Oracle OpenJDK builds are identical, but are licensed in different ways (commercial and GPLv2+CE respectively).
Oracle JDK / Oracle OpenJDK builds and OpenJDK builds from other providers will be built from the same source for the first six months of updates and should be interchangeable for that period. After six months Oracle JDK / Oracle OpenJDK builds will be built from Oracle’s own fork. Other OpenJDK providers will continue to create binaries from the OpenJDK updates project. Oracle JDK / Oracle OpenJDK and OpenJDK builds from the other providers may therefore differ in small ways. Binaries from various parties may, of course, vary over time.
Q. Differences between OpenJDK from (non-Oracle) provider A vs provider B?
We’ll just talk about LTS releases here. As has been the case with the Java SE 6 and Java SE 7 updates projects, various providers work together upstream in the OpenJDK community, which provides the common repositories, mailing lists, and other infra to share the work. This means the difference between OpenJDK-based binaries are mostly non-core features, like extended monitoring and diagnostic support. Although there may be small differences in the final binaries (perhaps a provider-specific tool etc) they will all at least have the same security and stability baseline as has been true for many years.
linux sort data size
Google'ed by: linux sort data size
https://serverfault.com/questions/62411/how-can-i-sort-du-h-output-by-size
Reference script: du | sort -nr | cut -f2- | xargs du -hs
Script that I used:
du --max-depth=1 / | grep -v '\.' | sort -nr | cut -f2- | xargs du -hs
2019-03-08
How to get the number of files in a folder as a variable?
Reference URL: https://stackoverflow.com/a/11132110/676104
How about:
count=$(find .. -maxdepth 1 -type f|wc -l)
echo $count
let count=count+1 # Increase by one, for the next file number
echo $count
Note that this solution is not efficient: it spawns sub shells for the
find
and wc
commands, but it should work.linux avoid echo to email
Maybe only happen while the sh script contains echo lines, and also schedule to crontab.
Googled: linux avoid echo to email
Reference URL: https://www.cyberciti.biz/faq/disable-the-mail-alert-by-crontab-command/
Cron job example
Edit/Open your cron jobs, enter:
Append string >/dev/null 2>&1 to stop mail alert:
$ crontab -e
Append string >/dev/null 2>&1 to stop mail alert:
0 1 5 10 * /path/to/script.sh >/dev/null 2>&1
OR
0 1 5 10 * /path/to/script.sh > /dev/null
OR
0 * * * * /path/to/command arg1 > /dev/null 2>&1 || true
Save and close the file.
Set MAILTO variable
You can set MAILTO=”” variable at the start of your crontab file. This will also disable email alert. Edit/Open your cron jobs:
At the top of the file, enter:
Save and close the file.
$ crontab -e
At the top of the file, enter:
MAILTO=""
Save and close the file.
Linux, let vs set
Reference URL: https://community.qlik.com/t5/QlikView-App-Development/let-and-set-difference/td-p/301811
Celambarasan
MVP02-21-2012 02:07 AM
let and set differenceHi,Let: Calculates the expression assigned to it and sets the expression result to the variable.Set: Assigns the value(or expression which is after the equal sign) as it is without compute.Example:Set vVar=2+3; //vVar has the expression 2+3 as value we have to compute it using $(vVar) which returns 5Let vVar=2+3;//vVar has the computed value 5Hope it helpsCelambarasan
2019-03-07
Using mutt-1.4.2.3.tar.gz in CentOS 5.11 & 6.7
After install using: https://billson.blogspot.com/2019/03/centos-install-mutt-1423targz.html
Then execute: /opt/Programs/mutt/bin/mutt
Reference URL:
- http://sheet.shiar.nl/mutt (guides on keyboard)
* to last message - https://github.com/JoshuaEstes/CheatSheets/blob/master/mutt.md (flag message)
w to choose flag a mail
ctrl + N Jump to next thread
ctrl + P Jump to previous thread - https://unix.stackexchange.com/questions/152429/search-in-mutt-by-date-and-time(limit)
press l, then key in string below:
~h 'you header to search' ~d 14/05/2018-31/05/2018 - https://bbs.archlinux.org/viewtopic.php?id=131257 (sort email)
Hey, thanks. The first one did not work for me, but the second (alternate) did, so this would be the correct config:
set sort=threads
set sort_browser=date
set sort_aux=reverse-last-date-received - http://emileswarts.github.io/2011/06/16/reference-sheet-for-mutt-commands.html
l – show messages matching a pattern - https://unix.stackexchange.com/questions/91046/search-for-mail-content-with-mutt (search message content)
manual:
~b EXPR messages which contain EXPR in the message body
eg:
~b 'Exception'
Scenario#01: Search emails, with subject contain 'Application error', between 2019 Jan 01-2019 Jan 31, message body contains 'Hello world'
press l, then key in string below:~h 'Application error' ~d 01/01/2019-31/01/2019 ~b 'Hello world'
Scenario#02: apply command to all tagged messages, Search email, key in search criteria, Tag all found message, "move" tagged messages to other mailbox(existing/new)
press l, then key in string below:
~h 'Application error' ~d 01/01/2019-31/01/2019 ~b 'Hello world'
press Shift + t
press enter again with predefined previous search criteria, to tag all found message.
press ;
key in s, then enter
then key in the target mailbox u want to "move"
mutt -f /var/spool/mail/john
https://www.tecmint.com/send-mail-from-command-line-using-mutt-command/
2019-03-06
CentOS 5.11 install mutt-1.4.2.3.tar.gz
Searched: CentOS install mutt from "mutt-1.4.2.3.tar.gz"
Reference URL: http://www.voidcn.com/article/p-wjuavxxu-dw.html
wget ftp://ftp.mutt.org/pub/mutt/mutt-1.4.2.3.tar.gz
tar -xvzf mutt-1.4.2.3.tar.gz
Configuration: https://unix.stackexchange.com/questions/170099/how-use-mutt-to-manage-var-spool-mail-user
vim ~/.muttrc
set folder=/var/spool/mail
set mbox=+YourFile
set sort=threads
set sort_browser=date
set sort_aux=reverse-last-date-received
./configure --prefix=/opt/Programs/mutt
if hit issue: configure: error: no curses library found
sudo yum install ncurses-devel.x86_64
make
sudo make install
/opt/Programs/mutt/bin/mutt
2019-03-05
VisualVM & ascii/UTF-8
Removed Java VisualVM
Java VisualVM is a tool that provides information about code running on a Java Virtual Machine. The
jvisualvm
tool was provided with JDK 6, JDK 7, and JDK 8.
Java VisualVM is no longer bundled with the JDK, but you can get it from the VisualVM open source project site.
Removed native2ascii Tool
The
native2ascii
tool has been removed from the JDK. Because JDK 9 and later releases support UTF-8 based properties resource bundles, the conversion tool for UTF-8 based properties resource bundles to ISO-8859-1 is no longer needed.Should I recompile my java projects when upgrade my JRE/JDK
Searched#1of2: is that necessary to recompile java for jdk security upgrade
Found:
- https://stackoverflow.com/questions/3846237/security-issues-of-compiling-against-older-jdks
Aside from some very hypothetical niche situation that hasn't ever happened yet, the only thing that matters is the version with which the application is executed.
I don't think there are any known security issues that have been "fixed" with @deprecated, because that wouldn't really be appropriate.
There are two issues at play here:
1) You can have your Java compiler produce binaries that are binary compatible with older versions. That affects the language features available to you.
2) You can compile against the Java system libraries of an older version, and that will affect what methods/classes are available, as they are always adding new ones.
But neither of these affects the security of your application. What matters is the runtime version with which the application is executed.
Observe that security problems are fixed between updates, not the major versions, which introduce changes in the language itself. For example, Java 6 is currently at update 21. Java 6 update 19 fixed stuff that was vulnerable in Java 6 update 18.
When Java 6 update 19 was released, updates were released for Java 1.5 and Java 1.4, to fix the same issues in Java 1.5 (update 24) and Java 1.4 (update 26). See the security baseline table here: http://www.oracle.com/technetwork/java/javase/6u19-141078.html
Searched#2of2: should I recompile classes when JDK security patch
Found:
- https://docs.oracle.com/en/java/javase/11/migrate/index.html#JSMIG-GUID-5657F44A-B2D7-4FB6-AAD7-295AC4533ABC
Compile Your Application if Needed
Subscribe to:
Posts (Atom)