Pages

Subscribe:

Ads 468x60px

Showing posts with label NetBeans. Show all posts
Showing posts with label NetBeans. Show all posts

Monday, November 3, 2014

Create a WSO2 Worker-Manager Cluster in Just 2 Minutes !

I've been working on an application(WSO2 Cluster Wizard) which creates a Worker-Manager Separated cluster for a given WSO2 Product. The objective of this application is to reduce the time spent on creating clusters in developers/testing local machines. Though puppet scripts can automate the process AFAIK, no one uses puppets to create clusters in their local setups'. 
This is a simple GUI application which is very easy to use. Here is a screen shot of the UI.
 
 Basic Functionality.
  1. Creates Worker-Manager separated cluster (WKA based)
  2. Choice of enabling registry mounting
  3. Works on almost every WSO2 product
  4. Works on both Windows and Linux environments 
How to use 
Run the application using java -jar ClusterWizard.jar
  1. Select the zip file of product you want to cluster
  2. Select the destination folder
  3. Fill out the Manager and Worker settings
  4. If registry mounting enabled fill out the mysql connection details
  5. Hit execute button.
Hope this will be useful, and highly appreciate your feedback. :)
In the next version I'll be hoping to add the WSO2ELB configuration support also.
Source can be found at. Github Link

Tuesday, August 16, 2011

How to build a fat jar using Netbeans

Hmm after long time with out blogging. Finally decided to add some posts to my blog. So in this post I would like to describe how to build a fat jar using NetBeans. Of course you can simply do it using Eclipse. But in Netbeans you can't actually directly build a fat jar. The jar which is build using NetBeans is not adding the libraries you've used for the project. The libraries are added to a folder called "lib" whenever you run the jar the "lib" folder must be in the same directory.

So lets get started building a fat jar using Netbeans. The first thing you have to do is clean and build the project.

Then go the Files view of the Project and open the build.xml file.

Then copy and paste the following code just before the " project" tag ends.

Download file from here DOWNLOAD FILE

Then it's almost done. Now in files view of the project right click build.xml file and then select Runtarget >> Other Targets >> package-for-store.

That's it now your fat jar has been created. Go to your project folder and check the folder called store. Inside that folder you can see your fat jar.

That's it now you know how to build a fat jar using NetBeans. If you need any help just put a comment. Cheers :)

Saturday, July 24, 2010

Hello World part 1

So here we are going to do our first program in J2ME Hello World...

First We need to install an IDE to code, debug and run our mobile applications. There are several IDE's available NetBeans, Eclipse, Borland JBuilder.. etc. I personally go for the NetBeans IDE though it takes huge amount of your RAM :) . I'm using NetBeans 6.1 it's a bit older version. I found that there is a bug in newer versions that you can't run multiple emulators at the same time. I haven't tried the latest release NetBeans 6.9. So the first thing you have to do is that download NetBeans (I highly recommend 6.1 rather than the latest versions since you find it very difficult when you come to WMAPI, Bluetooth.. etc ) and install it in to your computer. (Before installing NetBeans hope you guys have installed Java Development KIT or we all known as JDK .. Click here)
Start your IDE and do the following..

1. Create a new Project.  File->New Project or Ctrl+Shift+N or Click Create New Project
    Select Mobility --> MIDP Application (My Project name is HelloWorld)
Create New Project
2. Give a name for your project. Make sure to uncheck Create HelloWorld  MIDlet
Create MIDP Application
3. Platform ,Device, Configuration , Profile Selection
Default Platform Selection
4. Create a package (My package name is hello)
Create a package
5. Create a new Midlet (My MIDlet name is Hello)

6. Now you have created a Midlet now lets start coding our first Mobile Application. This is a very simple program and when you press the "OK" button it pop up an Alert (I'll explain what is an Alert in Hello World  part 2 ). And when you press the "EXIT" button application will be closed. 
The code snippet is given below..

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Hello;

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

/**
 * @author Aruna Sujith
 */
public class Hello extends MIDlet implements CommandListener {

    Display myDisplay;
    Form myForm;
    Command ok;
    Command exit;

    public Hello() {
        myDisplay = Display.getDisplay(this);
        myForm = new Form("Hello");
        ok = new Command("OK", Command.OK, 1);
        exit = new Command("EXIT", Command.EXIT, 0);
        myForm.addCommand(ok);
        myForm.addCommand(exit);
        myForm.setCommandListener(this);

    }

    public void startApp() {
        myDisplay.setCurrent(myForm);
    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }

    public void commandAction(Command c, Displayable arg1) {
        if (c == ok) {
            Alert alert = new Alert("Hello World!", "Hey It Really works!!!!", null, AlertType.INFO);
            alert.setTimeout(Alert.FOREVER);
            myDisplay.setCurrent(alert, myForm);

        } else if (c == exit) {
            destroyApp(true);
            notifyDestroyed();
        }
    }
}

To build the project; right click on the project --> click "Build" to build the project
To run the Peoject: right click on the project --> click "Run" to run the project or simply press F6 :-)
If you have completed the above instructions when you run the project you should have a emulator started.

The Emulator
Launch the program you will see two buttons press "OK" and "Exit" and see what happens. So this is it this is it. This is a simple program  and I' will explain more about the code and theory  in my next post " Hello World part 2 ". If you have any problem while doing this please put a comment. I'll answer as soon as possible to the best of my knowledge. Hope you'll enjoy programming mobile devices in J2ME .You can even try out this program in your own mobile. See you around... :-)