Thursday, September 29, 2011

Pre-Built Developer VMs, for Oracle VM VirtualBox.

Oracle have packaged pre-built Oracle VM VirtualBox appliances that you can download, install, and experience as a single unit. Just assemble the downloaded files (if needed), import into VirtualBox (available for free), import, and go!

Developer VMs are currently available in these flavors, with more to come.
  • Java Development VM
  • Database App Development VM
  • SOA & BPM Development VM
  • Enterprise Java Development VM
  • Oracle WebCenter Portal Framework 11g Hands-on VM
  • Oracle Solaris 11 Express Developer VM
  • Oracle Solaris 11 Express Network Virtualization VM
  • Oracle Tuxedo Web Application Server Demo VM
  • Enterprise PHP Development VM
  • Oracle Business Intelligence Enterprise Edition Plus VM

Know more>>

JavaOne 2011 app on mobile

The JavaOne application provides a comprehensive view of all things JavaOne— the flagship annual conference for Java developers worldwide ! taking place in San Francisco from October 2-6, 2011. Find out what's happening and where at JavaOne ‑all of the activities you need to attend, all of the people you want to meet—all on your mobile device.


link: JavaOne Web Site

Wednesday, September 28, 2011

Implement Insertion Sort in Java

Example of Insertion Sort using Java code:
public class InsertionSort {

public static void main(String[] args) {
System.out.println("Hello, Java-Buddy!");

MyData myData = new MyData();; //Before sort
myData.InsertionSort();; //After sort

static class MyData {

final static int LENGTH = 10;
static int[] data = new int[LENGTH];

//Generate the random data
for (int i = 0; i < 10; i++) {
data[i] = (int)(100.0*Math.random());

void InsertionSort(){
int cur, j;

for (int i = 1; i < LENGTH; i++) {
cur = data[i];
j = i - 1;

while ((j >= 0) && (data[j] > cur)) {
data[j + 1] = data[j];

data[j + 1] = cur;

void show(){
for (int i = 0; i < 10; i++) {
System.out.print(data[i] + " ");


Insertion Sort in Java

Sunday, September 25, 2011

JDK 7 in a Nutshell

O'Reilly OSCON Java 2011: Joe Darcy, "JDK 7 in a Nutshell"

Saturday, September 24, 2011

NetBeans: Setting Events With the Connection Wizard

Connection wizard can help to set events between two components within a form without having to write code manually.

Work on the exercise in last post "HelloNetBeans: Create Java Desktop Application using NetBeans IDE".

- Add a Button on Design Pane
- Right click on Button, Edit Text and enter "Click Me" as the text on the button.
Add a Button

- Switch Connection Mode.
Switch Connection Mode

- Select the component (JButton1) that will fire the event, the selected component is highlighted in red when selected.
- Select the component (JLabel1) whose state you want to affect with the event.
- NetBeans will open Connection Wizard.

- Accept jButton1 as Source Component.
- Expand and select mouse -> mouseClicked as the source Events, with jButton1MouseClicked as Method Name in Event Handler Method.
- Click Next.
Select Source Event

- Accept jLabel1 as Target Component.
- Select Set Property.
- Select text. and click Next.
Specify Target Operation

- Select and Enter Value of any text you want, and click Finish.
Enter Parameters

- NetBeans will generate the code for you.
Code generated by Connection Wizard

- Save and Run it again.
Application Run

Friday, September 23, 2011

HelloNetBeans: Create Java Desktop Application using NetBeans IDE

- Start NetBeans IDE, click File -> New project... on top menu

- Select Categories of Java, and Projects of Java Desktop Application, and click Next.
New Project of Java Desktop Application

- Review Disclaimer and click Next.

- Enter Project Name (HelloNB), and select Basic Application in Choose Application Shell box, and click Finish.
Setup project

- Place a Label:
Like other GUI IDE, simple drag a Label (under Swing Controls) from the Palette pane over the Design Pane.

- Change the Label text:
Right click on the Label and select Edit Text.
Edit Label text

Enter the text.
Enter Label text

- Save All and Click the Green arrow icon to run the application.

- NetBeans: Setting Events With the Connection Wizard

- If you cannot find Java Desktop Application in your NetBeans IDE, you can "Manually create GUI application of Hello World on NetBeans 7.2.1".

Wednesday, September 21, 2011

MyFirstApplet, run applet in HTML page

Create a file
import javax.swing.JApplet;
import java.awt.Graphics;

public class MyFirstApplet extends JApplet {

public void paint(Graphics g) {
g.drawString("Hello, Java-Buddy!", 50, 50);

Compile it in command prompt:


Create a HTML file MyFirstApplet.html, embed MyFirstApplet.class inside.
<title> Java-Buddy </title>
<applet code = "MyFirstApplet.class" width = 300 height = 300 >

Open MyFirstApplet.html in browser.
MyFirstApplet, run applet in HTML page

Tuesday, September 20, 2011, first java code

Create the first java program,, using plain text editor.

public class HelloJavaBuddy {

public static void main(String[] args) {
System.out.println("Hello, Java-Buddy!");


Compile the code using the command:

Run it:
java HelloJavaBuddy


Monday, September 19, 2011

Google APIs Client Library for Java announced, support OAuth 2.0

Google have announced the Java client library. With the version 1.5 release, the open source Google OAuth Client Library for Java is available in Beta, support for both OAuth 1.0a and OAuth 2.0. OAuth is an open standard for allowing a client application to securely gain access to a user’s private data stored on Google without ever asking for their password.

source: The official Google Code blog - Google APIs Client Library for Java: now with OAuth 2.0

Best Practices for Accessing Google APIs on Android

Integration with Google APIs (such as Buzz, Latitude and Translate) can enrich many Android applications. The video demonstrate how to do so easily, efficiently and securely using the Google API Client for Java. it'll walk you through how to authenticate for the APIs using AccountManager, how to reduce the client library size and several other Android-specific optimizations.

Ivor Horton's Beginning Java, Java 7 Edition

Ivor Horton's approach is teaching Java is so effective and popular that he is one of the leading authors of introductory programming tutorials, with over 160,000 copies of his Java books sold. In this latest edition, whether you're a beginner or an experienced programmer switching to Java, you'll learn how to build real-world Java applications using Java SE 7. The author thoroughly covers the basics as well as new features such as extensions and classes; extended coverage of the Swing Application Framework; and he does it all in his unique, highly accessible style that beginners love.

  • Provides a thorough introduction to the latest version of the Java programming language, Java SE 7
  • Introduces you to a host of new features for both novices and experienced programmers
  • Covers the basics as well as new language extensions and classes and class methods
  • Guides you through the Swing Application Framework for creating Swing apps
  • Uses numerous step-by-step programming examples to guide you through the development process

There's no better way to get thoroughly up to speed on the latest version of Java than with Ivor Horton's latest, comprehensive guide.

NetBeans IDE 7.0.1 with JDK 7

The NetBeans IDE is an award-winning integrated development environment available for Windows, Mac, Linux, and Solaris. The NetBeans project consists of an open-source IDE and an application platform that enable developers to rapidly create web, enterprise, desktop, and mobile applications using the Java platform, as well as PHP, JavaScript and Ajax, Groovy and Grails, and C/C++.

NetBeans IDE 7.0 introduces language support for development to the Java SE 7 specification with JDK 7 language features. The release also provides enhanced integration with the Oracle WebLogic server, as well as support for Oracle Database and GlassFish 3.1. Additional highlights include Maven 3 and HTML5 editing support; a new GridBagLayout designer for improved Swing GUI development; enhancements to the Java editor, and more.

The latest available download is NetBeans IDE 7.0.1, which is an update to NetBeans IDE 7.0.


how to:
- Create Java Desktop Application using NetBeans IDE
- Setting Events With the Connection Wizard

Sunday, September 18, 2011

Java Magazine for FREE

Java Magazine is published on a bi-monthly basis in digital and mobile formats. It includes:
  • Profiles of innovative Java applications
  • Java technical how-to’s: Enterprise Java, New to Java, Rich Client, Polyglot Programming, and more
  • Java community news: Java User Groups, JCP standards, and more
  • Information about new Java books and conferences and events


Java is a programming language originally developed by James Gosling at Sun Microsystems (which is now a subsidiary of Oracle Corporation) and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities. Java applications are typically compiled to bytecode (class file) that can run on any Java Virtual Machine (JVM) regardless of computer architecture. Java is a general-purpose, concurrent, class-based, object-oriented language that is specifically designed to have as few implementation dependencies as possible. It is intended to let application developers "write once, run anywhere." Java is currently one of the most popular programming languages in use, particularly for client-server web applications.

The original and reference implementation Java compilers, virtual machines, and class libraries were developed by Sun from 1995. As of May 2007, in compliance with the specifications of the Java Community Process, Sun relicensed most of its Java technologies under the GNU General Public License. Others have also developed alternative implementations of these Sun technologies, such as the GNU Compiler for Java, GNU Classpath, and Dalvik.

Ref: Wikipedia - Java (programming language)


Java Buddy