Comparator Interface and sorting in Java

Comparator interface is used to order the objects of user-defined classes. A comparator object is capable of comparing two objects of two different classes. Following function compare obj1 with obj2 Syntax: public int compare(Object obj1, Object obj2): Suppose we have an array/arraylist of our own class type, containing fields like rollno, name, address, DOB etc … Continue reading Comparator Interface and sorting in Java

How to configure Processing to run on Raspberry Pi?

Processing is an open source programming language (processing.org) and environment for people who want to create images, animations, and interactions. This is how to install it on your Raspberry PI: install the java 6 sdk sudo apt-get install librxtx-java openjdk-6-jdk download and unzip the Linux (x86) version of Processing 1.5.1 to the /home/pi directory http://processing.googlecode.com/files/processing-1.5.1-linux.tgzContinue reading How to configure Processing to run on Raspberry Pi?

How to run system commands Java (Linux environment)

In Python, we use import os os.system('sudo vncserver stop')   What about in Java. Below is one example. import java.io.*;   public class java_system_call {       public static void main(String args[]) {           String s = null;           try {                       // run the Unix "ps -ef" command             // using the Runtime exec method:             Process … Continue reading How to run system commands Java (Linux environment)

Write once, run anywhere (Java)

This is an interesting reading from Wikipedia. "Write once, run anywhere" (WORA), or sometimes write once, run everywhere (WORE), is a slogan created by Sun Microsystems to illustrate the cross-platform benefits of the Java language. Ideally, this means Java can be developed on any device, compiled into a standard bytecode and be expected to run … Continue reading Write once, run anywhere (Java)

A note on Java compilation on Windows, Ubuntu, and Raspberry Pi (Debian)

Here is some basic info for these three platforms (in particular, Java environment). A side note - I tried Geany, Netbeans, and BlueJ on Raspberry Pi. It seems that none of these IDE's is fast enough to do the work. The most efficient way to compile the Java source code probably is through command lines. … Continue reading A note on Java compilation on Windows, Ubuntu, and Raspberry Pi (Debian)