Posts

How to run NetBeans 8 if multiple java version (Java 8 and Java 9) is available on MacOS

Image
After installing Java 9 NetBeans stopped working properly and instead of setting up the default java version to java 8 it was using java 9. I have figured out a solution to run NetBeans with Java 8 and also having Java 9 on MacOS to test new features available in Java 9. My approach to switching between different versions of java (in .profile) : Install both Java versions (Java 8 and Java 9) and also install NetBeans. Add the below lines in .profile under your user directory. export JAVA_7_HOME=$(/usr/libexec/java_home -v1.7) # add this line if you have Java 7 installed export JAVA_8_HOME=$(/usr/libexec/java_home -v1.8) export JAVA_9_HOME=$(/usr/libexec/java_home -v9) #create alias to switch instantly with java versions alias java7='export JAVA_HOME=$JAVA_7_HOME' alias java8='export JAVA_HOME=$JAVA_8_HOME' alias java9='export JAVA_HOME=$JAVA_9_HOME' #set default java version export JAVA_HOME=$JAVA_8_HOME To run NetB...

How to implement stack data structure in Java without using collections.

Implementing Stack without using Collections  // Create interface called Stack public interface Stack { void push(Object value ); Object pop(); int length(); } // Create class implementing Stack interface named StackImpl public class StackImpl implements Stack { private Node head ; private int length ; @Override public void push(Object value ) { Node node = new Node( value ); if ( head == null ) { head = node ; } else { node . next = head ; head = node ; } length ++; } @Override public Object pop() { Object result = null ; if ( head != null ) { result = head . value ; head = head . next ; length --; } return result ; } public int length() { return length ; } private class Node { private Object value ; private Node next ; public Node(Object value ) { super (); this . value...

Gluon Announces Full Java 9 Mobile Initiative

Gluon  has announced the  Gluon VM  project bringing Java 9 support to mobile developers and unlocking the availability of all OpenJDK APIs.  As a full OpenJDK implementation, the company says their Gluon VM will form the basis for future releases of  Gluon mobile , and will allow enterprise developers to benefit from the latest developments in Java 8 and Java 9. Launched 18 months ago, the Gluon mobile offering provides plugins for the main Java IDEs, for building Java applications for Android and iOS platforms using a single code base. According to company co-founder John Vos, Gluon Mobile abstracts out the underlying hardware, providing a common API for accessing hardware and building dynamic user interfaces. In order to execute Java code on mobile devices the device must be able to interpret Java bytecode, and therein lies the rub. Until now Gluon Mobile deployments on Android devices would ...

Differences between JavaFX and Swing

NOTE : Oracle hasn't completely abandoned Swing — it isn't deprecated, and Swing applications continue to work. But no work is being done anymore to enhance Swing, and Oracle has made it clear that JavaFX is the future. Here are ten basic differences between JavaFX and Swing. In JavaFX, all the world's a stage In Swing, the class that holds your user interface components is called a frame and is defined by the JFrame class. A frame is essentially an empty window to which you can add a panel, which serves as a container for your user-interface elements. A panel is defined by the JPanel class. A Swing application is actually a class that extends the JFrame class. To display user-interface components, you add components to a JPanel and then add the panel to the frame. JavaFX uses the metaphor of a theater to model the top-level containers of an application. A stage (defined by the Stage class) represents the highest level container — ty...

The improved Java packager would include features to align with a modular Java platform

Java modules, in the works for years and now set to debut in 2016, will involve improvements to the Java Packager, to reduce the size of the Java Runtime Environment. In a JDK Enhancement Proposal (JEP) floated this week on an Internet bulletin board, the Java Packager tool could be integrated with features from the  Project Jigsaw  modularization plan. Java Packager is used to compile, package, and deploy Java applications from the command line. “The Java Packager has always generated huge binaries when it is asked to bundle a runtime as part of its packaging due to the size of the JRE, which for some distributions is on the order of 100MB,” the proposal states. “Jigsaw will expose tools and techniques that can reduce the size of the JRE we need to package.” The proposal stipulates that, for the most part, packager workflow will remain as is. But tools from Jigsaw will be added and replace some steps. The packager will only create applications using the JDK 9 ...