Archive for March, 2011

Pausing Execution of Java Program

March 31, 2011

Sometimes, we may need to wait for in between the execution of our java program. Thread.sleep() is the best way to do so. A sample code taken directly from Oracle Site :

public static void main(String args[]) throws InterruptedException {
String importantInfo[] = {
“Mares eat oats”,
“Does eat oats”,
“Little lambs eat ivy”,
“A kid will eat ivy too”
};

for (int i = 0; i < importantInfo.length; i++) {
Thread.sleep(4000);
System.out.println(importantInfo[i]);
}
}

Happy Coding 😉

 

Java versions of Domino (Lotus Notes Server)

March 17, 2011

Java was integrated into Lotus Notes beginning with Release 4.5. With Release 5, Java support was greatly enhanced and expanded, and JavaScript was added. The latest release of Lotus Notes 8.5.2 supports java 1.6. The available java versions for the different Domino Server Versions are :

1.0 to 3.x : Not Available
4.5 to 4.6.7a : JRE/JDK 1.1
5.0 to 5.0.13a : JRE/JDK 1.1.8
6.0 to 6.5.6 : JRE/JDK 1.3.1
7.0 to 7.0.3 : JRE/JDK 1.4.2
8.0 to 8.0.1 : JRE/JDK 1.5.0
8.5 to 8.5.2 : JRE/JDK 1.6.0

For more details see here :: Supported versions of Java with IBM Lotus Products

Happy Coding 🙂

Get the version of Java runtime

March 16, 2011

There may be occasions when you will need to do different processing for different servers based on the java versions present. You can simple use the System.getProperty(“java.version”) to get the current java version of the runtime.

public class Test {
public static void main(String[] args){
System.out.println(System.getProperty(“java.version”));
}
}

If you want to get the major minor version of Java you can use :

System.out.println(System.getProperty(“java.class.version”));

Similarly there are a set of system properties which can come handy at many times. To get a complete list of all the java properties, run the following program ::

import java.util.Enumeration;
import java.util.Properties;

public class Test {

public static void main(String[] args){
Properties p = System.getProperties();
Enumeration e = p.propertyNames();
while(e.hasMoreElements()){
String pro = (String) e.nextElement();
System.out.println(pro + ” :: ” + System.getProperty(pro));
}
}
}

Happy Coding 🙂


%d bloggers like this: