Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 JAVA


  Different ways to print "Hello world" in Java

This post is not about best practice to print "Hello world" in Java, it is about exploring different capabilities offered by Java. Also there are articles about printing "Hello world" in different programming languages, but this post is not about that.Standard literalThe most commonly used way is to use System.out to print"Hello world".System.out.println("Hello world");EnumerationAn enumeration can define a set of values belonging to one category. For example, an enumeration for all months in a year. Another great use of enumeration is in writing testcases to accept different testing para...

7,818 0       JAVA FEATURE


  Run executable jar on double click on Windows

Normally after installing Java, there will be an association between .jar and the javaw.exe. This enables the executable jar to be opened on double click. You can check the association by going to Control Panel -> Programs -> Default Programs -> Associate a file type or protocol with a program.The default program of a file type can be changed in this dialog. However sometimes there are cases where the file association for .jar may be altered after a third party application installed. The executable jar may not be able to be started normally post that and it still doesn't work eve...

25,987 3       JAVA WINDOWS JAR EXECUTABLE JAR


  Launch Java process programmatically in Java

In some cases while working on some automation testcase, developers would like to launch Java process programmatically so that the tests can be ran without manual intervention. Java provides such methods to achieve this.ProcessBuilder can be used to build a Java process which can be launched when everything is ready. Basically it can take a list of parameters which are similar to the command line options/arguments. For example, if you want to launch a Java process, you can do following.public final class JavaProcess { private String output = ""; private String javaHome = ""; public ...

8,276 0       JAVA COMMAND LINE PROCESSBUILDER


  Different module types in Java 9

Java 9 is going to introduce a disruptive change to the Java platform -- Module System. The module system will change how Java applications work in the future. It's like changing the foundation of a house without impacting the house functionality and its top level structure. This obviously is a big challenge for the whole Java community. To bring as little pain as possible to migrate existing applications to Java 9 without refactoring the whole application, Java 9 will introduce a few different module types. In following sections, these different module types will be covered.But before co...

8,241 1       JAVA JAVA 9 JIGSAW MODULE SYSTEM UNNAMED MODULE AUTOMATIC MODULE NAMED MODULE


  String intern in Java

In Java, == is used to compare whether two objects have the same memory location, equals() is usually used to compare whether two objects have the same time and the same state.  When comparing two strings, normally we just want to know whether they have same content, so we can choose equals(). But since String comparison is so frequently needed, Java has worked on the String class to make == workable when comparing two String literals.The String class maintains a pool of empty string literals initially. Then when a new string is created, this new string will checked against...

3,888 0       JAVA STRING


  New features in Java 9

Java 9 is planned to be released in March 2017. It will be 3 years since Java 8 was released. Are you still excited about the new features introduced in Java 8 such as Lambda, new Date APIs etc? Now Java 9 is to be released and there are also quite a few fantastic new features to be introduced.Below is a list of major new features in Java 9.Modular system. Java 9 will introduce a brand new modular system to organize Java codes. The modular system will divide different packages into different modules to ensure reliable configuration and strong encapsulation. With this, you only need to shi...

17,457 4       JAVA NEW FEATURE JAVA 9


  JShell -- The command line tool to run Java code in Java 9

Java 9 is currently a work-in-progress and is planned to be GAed in March 2017. Quite a few new features will be introduced in the new release. The coolest feature is project Jigsaw which is to modularize the Java packages so that a customized JDK can be built and shipped with only the necessary modules to fulfill their project requirement. Apart from this feature, another big new feature is project Kulla -- JShell.In simple, JShell is a command line tool which can be used to run Java code snippet without wrapping them into classes. It is similar to tools for other languages suc...

24,401 8       JAVA 9 JSHELL KULLA


  Oracle released an urgent Java patch

On March 23, Oracle just released an urgent Java patch which is out of its normal update schedule. The security vulnerability is related to the Java SE running in web browsers on desktops. The CVE ID for this issue is CVE-2016-0636.With the unpatched Java, attackers can remotely exploit the target system without username and credentials. Successful exploits can impact the availability, integrity, and confidentiality of the user's system. When the user access pages containing malicious codes on an affected web browser, they are vulnerable to this attack.The vulnerability only affects ...

3,938 0       JAVA SECURITY ORACLE NEWS