Wednesday Aug 12, 2009

Netbeans Java Presentation

Small presentation(actually very small) on Netbeans and Java. Mostly covers the features, netbeans provide for Java SE. Like Profiling, Debugging..

http://blogs.sun.com/vaibhav/resource/BasicOfNetbeans_Java.pdf



Saturday Aug 09, 2008

JavaFX, Constrain check - Next Part !

As we discussed in the last blog, about easing and constraint. Now we have seen the ball is moving inside the box but not completely. And this is not possible as well because the mouseMove code has been written on the box and mouse can move anywhere in the box. So, the basic funda comes first is to make one virtual box bigger than target box and the mouseMove code should be written on the outer virtual box rather than the box inside which we want to move our ball. Now the real constraint part, that will be written inside the onMouseMove code: 

                onMouseMoved: function( e: MouseEvent ):Void {
                    mouseX = e.getX();
                    mouseY = e.getY();
                    if(mouseX < rect.x + circleRadius ) {
                        mouseX = rect.x + circleRadius
                    };
                    if(mouseX > rect.x + rect.width - circleRadius ) {
                        mouseX = rect.x + rect.width - circleRadius
                    };

                    if(mouseY < rect.y + circleRadius ) {
                        mouseY = rect.y + circleRadius
                    };
                    if( mouseY > rect.y + rect.height - circleRadius ) {
                        mouseY = rect.y + rect.height - circleRadius
                    };
                }

Here, rect is the target box inside which we want the ball to move. So, if mouse position is going out of the boundary, we are pushing it inside the boundary. I am still damn sure, some checking may be missing. Now, this mouseMove will go into the outer bigger circle. Here is the final code: 

 package constraintcheck;

import javafx.application.Frame;
import javafx.application.Stage;
import javafx.scene.geometry.Circle;
import javafx.scene.paint.Color;
import javafx.input.MouseEvent;
import javafx.scene.transform.Translate;
import javafx.animation.Timeline;
import javafx.animation.KeyFrame;
import java.lang.Math;
import javafx.scene.geometry.Rectangle;

var mouseX : Number = 100;
var mouseY : Number = 100;
var circleX : Number = 300;
var circleY : Number = 300;
var t : Number = 100;
var easing : Number = 0.05;
var circleRadius : Number = 50;

var timeline = Timeline {
    repeatCount: Timeline.INDEFINITE
    keyFrames : [
        KeyFrame {
            time : 16ms
            action : function() {
                if( 
                Math.abs(mouseX - circleX ) > 0.1 ) {
                    circleX = circleX + (mouseX - circleX ) \* easing;
                }
                if( Math.abs(mouseY - circleY ) > 0.1 ) {
                    circleY = circleY + ( mouseY - circleY ) \* easing;
                }
            }
        }
    ]
}

Frame {
    title: "Constrain Check"
    width: 700
    height: 700
    closeAction: function() { java.lang.System.exit( 0 ); 
    }
    visible: true

    var rect = Rectangle {
        x: 100, y: 100
        width: 400, height: 400
        fill: Color.RED
   }
    stage: Stage {
        content: [ 
            Rectangle {
                x: 0, y: 0
                width: 500, height: 500
                fill: Color.BLACK
                onMouseMoved: function( e: MouseEvent ):Void {
                    mouseX = e.getX(); 
                    mouseY = e.getY();
                    if(mouseX < rect.x + circleRadius ) { 
                        mouseX = rect.x + circleRadius
                    };
                    if(mouseX > rect.x + rect.width - circleRadius ) { 
                        mouseX = rect.x + rect.width - circleRadius
                    };
 
                    if(mouseY < rect.y + circleRadius ) { 
                        mouseY = rect.y + circleRadius
                    };
                    if( mouseY > rect.y + rect.height - circleRadius ) { 
                        mouseY = rect.y + rect.height - circleRadius
                    };
                }
            },rect,
            Circle {
                centerX: bind circleX, centerY: bind circleY
                radius: circleRadius
                fill: Color.GRAY
            }
        ]
        fill: Color.BLACK 
    }
}
timeline.start();

It combines both the code, easing part and the constaint part :-). Virual box has been made by filling the rectangle same color as of frame.  Now, you can play around with the coordinate value and check its working fine or not. Still some condition need to check like the outer box size should be bigger. Now, look at the code of Constraint.fx written in Netbeans 6.1 example :-P.

JavaFX and giving motion with mouse - Easing factor

When we write animation code like moving a circle or rotating a cube, we do a bad thing. We write the coordinates according to our ease and later its pain  for others to understand the code. In the code, you will see 450 - size or 200 + radius. Now, its really tough to guess what this 450 and 200. It came from direct calculation or from addition, multiplication. Sometimes, in our mind we do those mathematical calculation and we put the final value. I have mostly done in all my previous code :-D. And this is how I got the Netbeans JavaFX sample example. For getting some hand into JavaFX code, I was trying to write a constraint code, which I was inspired from NB example, Constraint.fx in the section Best Practices -> Input. And it was all pain to understand that code, because the manipulation was done like a mathematician not like a coder. Anyway, let me first finish this blog and then you can compare it yourself.

Two good thing that code covers :-

1. How to do easing (there is a separate example of that as well): 

Now, when we move the mouse from one position to other, we don't want our ball(say, we are moving a ball) to stick with mouse and keep on moving with mouse. We want it into a form of motion. Like from the last position of mouse to this new position of mouse, the ball slowly moves. This can be achieved by easing  :

Have a look:

onMouseMoved: function( e: MouseEvent ):Void {
    mouseX = e.getX();
    mouseY = e.getY();

Now, if we bind our X and Y(center) of circle with mouseX, mouseY, the look will come ugly :-)( a sticky look). So, we will write an integral code here:

if(Math.abs(mouseX - circleX ) > 0.1 ) {
   circleX = circleX + (mouseX - circleX ) \* easing;
}
if( Math.abs(mouseY - circleY ) > 0.1 ) {
   circleY = circleY + ( mouseY - circleY ) \* easing;
}

We are doing something same but in a fashionable style. We are increasing the value of CircleX and CircleY in bits and pieces and the smoothness depends on the value of easing factor which we have multiplied at the end. Lets have a look to this full code how it work :

package easingcheck;

import javafx.application.Frame;
import javafx.application.Stage;
import javafx.scene.geometry.Rectangle;
import javafx.scene.paint.Color;
import javafx.scene.geometry.Circle;
import java.lang.Math;
import javafx.animation.Timeline;
import javafx.animation.KeyFrame;
import javafx.input.MouseEvent;

var mouseX: Number;
var mouseY: Number;
var circleX: Number = 250;
var circleY: Number = 250;
var easing = 0.04;

var timeline = Timeline {
    repeatCount: Timeline.INDEFINITE
    keyFrames : [
        KeyFrame {
            time : 16ms
            action : function() {
                if( Math.abs(mouseX - circleX ) > 0.1 ) {
                    circleX = circleX + (mouseX - circleX ) \* easing;
                }
                if( Math.abs(mouseY - circleY ) > 0.1 ) {
                    circleY = circleY + ( mouseY - circleY ) \* easing;
                }
            }
        }
    ]
}
Frame {
    title: "MyApplication"
    width: 500
    height: 500
    closeAction: function() { java.lang.System.exit( 0 ); 
    }
    visible: true

    stage: Stage {
        content: [ 
            Rectangle {
                x: 100, y: 100
                width: 300, height: 300
                fill: Color.BLACK
                onMouseMoved: function( e: MouseEvent ):Void {
                       mouseX = e.getX();
                       mouseY = e.getY();
 
                }
            },
            Circle {
                centerX: bind circleX, centerY: bind circleY
                radius: 20
                fill: Color.RED
 
            }
        ]
    }
}
timeline.start();

We can see a smooth movement of ball(if you want to see ugly look once, then bind centerX and centerY on MouseX and MouseY). Also notice that ball is not coming out of the rectangular box because the OnMouseMoved code has been written inside the box. So, it should not come out of the box. We have to constraint the ball inside the Rectangular box completely, right now half of the ball is coming out of the box. This is 25 percent of the story. We will see how to do this job, which looks easy but not so. Keeping mind of blog size, I am continue into next blog :-)

Tuesday Jul 29, 2008

Boat in an ocean :-) JavaFX !

OK, nothing to laugh. I know my animation sense is little poor. But here I tried to move a ship, in the way they show in movies -D. Nothing like that, I have tried to give a sinusoidal movement of a ship. In the comment section, you can see there is a sea image as well. Animation was looking little ugly with sea, so I removed it :-). But point to note, you can give any animation to a image based on any mathematical methods. And if you have a complex equation, you can fit that in, in place of my simple sin curve. Here is the code:

package move;

import javafx.application.Frame;
import javafx.application.Stage;
import javafx.scene.paint.Color;
import java.lang.Math;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.scene.image.ImageView;
import javafx.scene.image.Image;

var time : Number = 0.0;


var timeline : Timeline = Timeline {
    repeatCount: Timeline.INDEFINITE        
    keyFrames : 
        KeyFrame {
            time : 5ms
            action: function() {
                time += 0.02;
            }                
        }
};
Frame {
    title: "MyApplication"
    width: 1200
    height: 500
    closeAction: function() { 
        java.lang.System.exit( 0 ); 
    }
    visible: true

    stage: Stage {
        fill: Color.AQUA
        content: [
     /\*       ImageView {
                image: Image {
                url: "http://birdblog.merseyblogs.co.uk/sea21206.jpg"
                 }
            },
     \*/
            ImageView {
                x:bind(100 + time \* 10)
                y:bind(100 + Math.cos(time) \* 10)
                image: Image {
                    url: "http://lal.cas.psu.edu/Research/visualiz/images/boat.gif"
                }
            }
        ]

    }
}
timeline.start(); 

Just 3-4 drags from Netbeans 6.1 FX viewer :

1.  One Timeline and an action inside it.

2. One Frame.

3. One Image.

Thats it ! Set the code logic and rest leave all the work on binding :-). Quite simple, just that I am not able to make some good animation out of it !

Friday Jul 18, 2008

Understanding JavaFX - Small Navigation Code

So finally I am able to write a small code with the new Java FX API and Builder provided in NB 6.1. I have also seen one bug got fixed (maybe initially it was handled on a different way). Initially when we make any FX project in Netbeans, it basically store the \*.fx code into classes folder as well. There is no way one can find the .class file of the .fx file, which is not a problem now.

I have written one small navigation code of map from key control. Which moves the map left, right, up and down from the corresponding key. And the most part of the code line is to handle the boundary condition like the image should not move left when it is already in left most region and so on. Thanks to Vikram for helping me out in writing boundary condition, this is always confusing for me :-D. Here is the small code:

import javafx.application.Frame;
import javafx.application.Stage;
import javafx.scene.paint.Color;
import javafx.input.KeyEvent;
import javafx.input.KeyCode;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.input.MouseEvent;
import javafx.scene.transform.Translate;
import java.lang.\*;
import javafx.scene.geometry.Line;

var x1 : Number = 0;
var y1 : Number = 0;
//var myImage = Image { url: "{__DIR__}/./earth-map-big.jpg" };
var myImage = Image { url: "http://arstechnica.com/reviews/4q00/macosx-pb1/images/earth-map-big.jpg" };
var line: Line;

Frame {
    title: "MyApplication"
    width: 500
    height: 500
    resizable: false
 
    closeAction: function() { 
        java.lang.System.exit( 0 ); 
    }
    visible: true
    stage: Stage {
        fill:Color.BLACK
        content: [
            ImageView {
                image : myImage
                transform : [ 
                    Translate { x : bind x1, y : bind y1 }
                ]
                onKeyPressed: function( e: KeyEvent ):Void {
                    System.out.println(x1 + " " + y1);
                   if(
                    e.getKeyText() == "Left")
                    {
                        if(x1 < 0) {
                            System.out.println(x1);
                            x1+=50;
                        }
                    }
                    if(
                    e.getKeyText() == "Right")
                    {
                        if(Math.abs(x1  -  500) < myImage.width) {
                            System.out.println(x1);
                            x1-=50;
                        }
                    }
                    if(
                    e.getKeyText() == "Down")
                    {
                        if(Math.abs(y1  -  500) < myImage.height) {
                            System.out.println(y1);
                            y1-=50;
                        }
                    }
                    if(e.getKeyText() == "Up")
                    {
                        if(y1 < 0) {
                            System.out.println(y1);
                            y1+=50;
                        }
                    }
                }
                opacity:1  
            }
        ]
   }
} 

I am loading the image from URL itself, so it will take sometime(because Image size is 3200 X 1600). Rest all is mathematics :-). Still lot more fancy job to do !

New JavaFX and Netbeans 6.1

Ah, in last 7 days I had written few examples of Java FX and it's nothing of use. I have installed the new plugin of JavaFX on Netbeans6.1. Quite a cool plugin, with FX builder, debugger and many more features. But all with these, the API of JavaFX also got changed. And none of the old code is running on new API base.

Anyway it takes sometime to get acquainted with it but whatever be the changes, new one looks cool. Have a look at the new builder of JavaFX :


How to learn Java FX with new API - Best is to go and check the Netbeans examples which are quite awesome. Knowing about the API's and Attributes. Check this path:

There are some issues I have seen with the ImageViewer feature in Netbeans. It crashes sometime, ok be honest, most of the time. So, the best way to handle it, run the ImageViewer only when you are done with the code. Close it, if you are changing the code. Open it again when you are done with changes. I guess, the subsequent patched will make it stable.

Tuesday Jul 08, 2008

Netbeans Configuration - Optimal ?

Oh today Angad was doing his project on Netbeans and suddenly start asking about GC Algo's. I asked "What happened" and it seems he was tuning the file "netbeans.conf" in netbeans\\etc. I have seen the same file on my computer. I was little surprised!

Maybe I don't know in detail because this all happened some 2 hrs back. But what we observe netbeans is not tuning the parameter or writing the file (netbeans.conf) according to system configuration/properties. Correct me if I am wrong, Netbeans write the same netbeans.conf file if I am working on a duo core processor or if I am working on a P2 machine. If yes, then I definitely want to know why? I guess Java provide enough API to know about no. of processor, RAM, disk, OS information and many more. Why not this file is best written according to machine configuration. Certainly a safe playing value in which we take care of the fact that netbeans or any process will not eat too much of RAM/Processor. This file should be written at the time of installation by reading the machine configuration.

Angad has given one more good suggestion, at the time of installation we can ask about the settings user want(current one or optimal tuning). Should be some reason of not doing this, but love to know why ?(No doubt, the tuning is written in best universal way, but why not specific)

By the way, got the tuning page of Netbeans : http://performance.netbeans.org/howto/jvmswitches/index.html.

Also, saw a plugin which takes input for command line setting(start up): http://plugins.netbeans.org/PluginPortal/faces/PluginDetailPage.jsp?pluginid=6829

Saturday Jun 07, 2008

Nominate OpenJDK, Netbeans !

Here it starts the nomination. Nominate OpenJDK for best project :). Is it not ?

Here goes the second nomination - Netbeans !

Tuesday Apr 22, 2008

Swing Framework Presentation

Weeks back, I had made one small presentation on Swing Framework which basically covers JSR 296. Here is the link to download the presentation.

For great detail, see the technical article on java.sun site: http://java.sun.com/developer/technicalArticles/javase/swingappfr/

If you want to run the codes, without Netbeans support, do the following steps:

1. Go on to this link: https://appframework.dev.java.net/ and take the source code of the project -
Source code: AppFramework-1.03-src.zip

2. Unzip it and compile it. Compilation will be easier in Netbeans as it makes jar file for you.

3. Run the code from command line: 

javac -cp  E:\\SwingFramework.jar Ex01.java          

(where  E:\\SwingFramework.jar is the location of jar file, we made in Step 2)

java -cp  E:\\SwingFramework.jar;. Ex01

NOTE: Best is to use Netbeans5.5+ :) 

Saturday Mar 08, 2008

Profiling with Netbeans 6

Working on industrial application,profiling project is one of the major
challenge. There are some of the profiling tools shipped with JDK like
jhat, jmap, jconsole. But week back, I start looking the profiling
power of Netbeans which is quite better than JDK tools. It provides
much better and relevant tools for profiling. Don't mind if it will not
able to connect VM sometime :). Here I have written one small code for
deadlock:



class DeadLockTest {
public static void main(String[] args) {
    Object lock1 = new String("Lock 1");
    Object lock2 = new String("Lock 2");
    new DeadLockCondition("t1", lock1, lock2);

    new DeadLockCondition("t2", lock2, lock1);
    }

}
class DeadLockCondition extends Thread {
Object lock1;

Object lock2;
DeadLockCondition(String name, Object lock1, Object lock2)

{

    super(name);

    this.lock1 = lock1;

    this.lock2 = lock2;

    start();

}
public void run() {

    while(true) {

        method();

    }

}

public void method() {

    synchronized(lock1) {

        method2();

    }

}
public void method2() {

    int count = 0;

    synchronized(lock2) {

        while(count<100000){

        count++;

        System.out.println(count);

        }

    }
}
}


Now I have started Netbeans Profiling. The best part is CPU profiling
which allow you to profile parts of project, no need to profile whole
project. It will show you heap memory, GC memory, classes loaded like:

 

 

Here you can definitely see how threads are waiting for each other in Thread view.

 


Now take the heap dump from Profiling option. It will by default open your heap dump in heap walker. Now in heap walker you can see classes, instances, size and lot many things. From classes we can directly go to the source code. See this:

 

 



And here I go in the source :)

 

 



There is lot to do here. But I am sick of pasting this image. Go ahead, and explore it :), it's worthwhile to spend some time. Right now, I am working on a printer memory leak problem. Will write more if able to solve with Profiling.


Wednesday Mar 05, 2008

Sun Tech Days - 2008

It was my second Sun Tech Days, again in Hyderabad. I was little upset that no one from my team is presenting anything, but again knowledge can come from any source :). Started with Rich Greens Key notes, it was a 3 day event.  I have attended lots and lots of presentation and here are some cool ones:

1. Netbeans day - A full day presentation by Roman and Chuk-Munn Lee. Both are awesome presenters in itself. They covered:

    - New Netbeans 6 features, I feel like its going to be the most powerful tool very soon.
    - Bean Binding
    - Swing Framework
    - Mobile Application with Netbeans 6
    - Platform Application
    - How to make NB plugins ... and many more.

All the session was excellent.

2. Java Debugging - This session mostly talks about Netbeans Profiling. How to use jhat, jconsole and all from NB. Though these tools are shipped with JDK6, NB gives a better support.

3. REST - Again an awesome presentation by Chuk-Munn. Talks about what REST is and how is different from SOAP.

4. GC Tunning - I haven't attended this session but my friends told me it was a good session again by Chuk-Munn, all about how to tune GC for your application.

5.  Lab on Java FX - the material is very good for the lab, specially for beginners like me.

There are some other good sessions as well. All together it was a good event.

Friday Dec 07, 2007

OpenJDK Build on Netbeans with Windows / Solaris - Part IV

So its all done for Windows. Now coming on to Solaris, here the work is little less in compare to Windows(the same is valid for Linux as well, can be a excuse for me as I don't have Linux machine right now). Here is the list of downloads:

-> OpenJDK - Same link as mentioned in the previous blog (download the Solaris part, we have worked on Solaris x86)
-> Binary Plugin - Download from here.
-> CUPS Header - Download the latest cups from here.
NOTE: CUPS is Common Unix Printing System. It is doing a smart job of putting browser information into a printable format. I mean you don't have to worry about how printing is going to happen, it will be taken care by CUPS.
-> FreeType - Download from the same link provided in the previous blog. Any of the platform independent version will work for us.
-> jtreg - jtreg can be downloaded from the same link from where you are downloading OpenJDK. jtreg is a test suite that contains tons of testcase. Responsibility is to write a safe code and code change will not screw anything.

Thats it ! I am assuming that you have Netbeans 6+ and JDK 1.7 and JDK 1.6 binaries installed with you.

Now setting the build.properties file. Its very small in comparison to windows. Here it is:

bootstrap.jdk={PATH_JDK7_INSTALL}
jtreg.home={JTREG_PATH}
make.options=\\
// this is important because code contains many
//line which work on if(OPENJDK==true) code
OPENJDK=true \\
ALT_BINARY_PLUGS_PATH={PATH_BINARY_PLUGS} \\
ALT_JDK_IMPORT_PATH={PATH_JDK7_INSTALL} \\
ALT_FREETYPE_LIB_PATH={FREE_TYPE_PATH}/lib \\
ALT_FREETYPE_HEADERS_PATH={FREE_TYPE_PATH}/include \\
ALT_BOOTDIR={PATH_JDK6_INSTALL} \\


All done. Time to fire the build. More likely you will face the same problem what we have mentioned for Windows. If you are lucky enough then you will get the message "BUILD SUCCESSFUL"
(If I missed some step, please follow as it is in previous blog)

Sunday Dec 02, 2007

OpenJDK Build on Netbeans with Windows / Solaris - Part III

Now if you all set according to the last blog. This is/are the possible error(s) :

1. Error in make file : Multiple target \*\*\* . Yes, you need to downgrade the version of make file. "make.exe" resides in /cygwin/bin/make.exe. Check out its version, if its not 3.80, time to downgrade it. Download from here. Replace the make.exe of cygwin with this new make.exe ( make -version should be 3.80).
NOTE: make.exe is responsible to run make files. Makefiles are the one which contains instructions for a specific project, which file to compile and in which order.

2. Compilation error in LocaleDataMetaInfo.java - Try out Igor's solution
NOTE: Cygwin(make of Cygwin) still have some problem in understanding \\r character. So, this error may go with the upcoming binaries of Cygwin. One way is just remove \\r from the sh file - localegen.sh. But then you will not get the proper LocaleDataMetaInfo.java file.

3. freetype.dll not found: Yes, freetype installation is  not creating any file like freetype.dll and this is surprising. If you investigate properly, you will get one file with name freetype.dll.a. Right now, lets rename it to freetype.dll(later we will check the problem of renaming this file)
NOTE: Just one line about freetype, it is providing uniform interface to access font files, support anti-aliasing as well.

4. I guess this is the main three error we came across. If anything else coming, then you need to check the installation of Cygwin again.  Errors like zip or tar.exe not found, means you have not installed the archive package of Cygwin.

Now if you are lucky enough, all things go fine and build will be ready. Again note that, jdk project module of Netbeans is only responsible for j2se build which mostly contains Java API not containing hotspot part. So, check the javac.exe and java.exe of your own openJDK build in the folder /openjdk/windows-i586/bin/.

5. Give a try to your HelloWorld.java Program. Ah it is running :-) cool. Now give a try on SimpleFrame.java in which you are creating a Frame. If unluck you will get this error: not a proper dll file: freetype.dll. So, renaming is not actually working which we did in Error 2. Actually .a is a library achieve which is not a proper  file at this point. So, what to do ? Either find proper freetype.dll file from somewhere or take the source of freetype and compile it on .NET according to these rule.

Now its all yours. If you get any additional error, please let me know via comment or drop me a mail

 

Saturday Dec 01, 2007

OpenJDK Build on Netbeans with Windows / Solaris - Part II

Talking of some of the details about OpenJDK building(on Netbeans), we can start with Windows build(x86). In general,building on windows is tougher than Solaris/Linux because there are lot of dependencies on other tools and we can't set up the tools on network. Now lets see the list of the downloads required (don't abuse me, I know its too much :-))

- OpenJDK - Download open source JDK

- Binary Plugin - Download Binary Plugin 

We need to install binary of Java SE 6, which we can get from Sun site and Java SE 7 which we can download from http://download.java.net/jdk7/binaries

Now this is all about JDK downloads. Time to put hand into the dirty world of other dependent tools:

1. As we have lot of C++ code(native code) inside JDK, we need a C++ compiler. For windows, JDK document suggests to use .NET2003. Though we have made the build on .NET 2003 but I guess compiler of .NET 2003 is free on net and you can give one try with free compiler. Note here: Don't try with .NET 2005 as many of the API get deprecated.

2. Cygwin Installation: This is a area of concern. We have invested(wasted :D) 90 percent of the build time in this tool. Installing, uninstalling, reinstalling .. and  it keep on going. On the first installation page of Cygwin itself , you will get two options: Unix/Binary or Dos/Text. Any option can work, can't work depending on your luck :-). Most of the engineer suggested me to install Unix/Binary but Dos/Text worked for us :D. Download from: Cygwin Site

NOTE: Don't forget to download Developer, System, Utility, Archive  package of its full mode not the default mode.

3. Install Microsoft DirectX 9.0 SDK(Summer Package) - Download it from Microsoft site

4. Download and Install FindBugs and Ant

5. Download Microsoft Unicode Library

6. Download and install latest version of freetype from www.freetype.org

7. Oops, if you don't have Netbeans 6 then download that also :)

Time to take a cup of coffee. Let the download to go on.

OK, back from coffee ...

Add Ant, Findbugs, Cygwin(till \\bin) in the path variable of system.  Open cmd, run vsvars32.bat (Micros~1.NET\\Common7\\Tools\\vsvars32.bat) to initialize the .NET variables. Run Netbeans.exe from the same command line.

Open openjdk/jdk/make/netbeans/ in netbeans and open project jdk. Open some of the important file like build.propertied and make.xml. In make.xml file, you will get the path of make, change it to the cygwin make file {cygwin/bin }.

Now IMPORTANT, get ready to write build.properties file:

bootstrap.jdk={PATH_JDK7_INSTALL}
make.options=\\
// this is important because code contains many
//line which work on if(OPENJDK==true) code
OPENJDK=true
// write the path in ~ format (dir /x)
ALT_COMPILER_PATH={MS.NET2003_PATH}/Vc7/bin \\    
ALT_MSDEVTOOLS_PATH= {MS.NET2003_PATH}/Common7/Tools/Bin \\
ALT_MSVCR71_DLL_PATH= {MS.NET2003_PATH}/SDK/v1.1/Bin \\
ALT_BOOTDIR={PATH_JDK6_INSTALL} \\
ALT_BINARY_PLUGS_PATH={PATH_BINARY_PLUGS}
ALT_JDK_IMPORT_PATH={PATH_JDK7_INSTALL} \\
ALT_DXSDK_PATH={DIRECTX_PATH} \\
ALT_FREETYPE_LIB_PATH={FREE_TYPE_PATH}/lib \\
ALT_FREETYPE_HEADERS_PATH={FREE_TYPE_PATH}/include \\
ALT_UNICOWS_LIB_PATH={UNICOWS_PATH} \\      
ALT_UNICOWS_DLL_PATH={UNICOWS_PATH} \\
LD_LIBRARY_PATH= \\
CLASSPATH= \\
JAVA_HOME= \\
SHLVL=1 \\     
             

All Done ! Fire the build now, if you are lucky enough you will get it done in some 20-30 minutes. In the next blog, we are going to talk about the problem(s) with some of this software and version dependencies.

Friday Nov 30, 2007

OpenJDK Build on Netbeans with Windows / Solaris - Part I

Our team is ready with OpenJDK build for FOSS.IN, better to
say partially ready :). Me and Vikram is going to give the live demo about
building OpenJDK and how you can optimize the source code according to your own
need. For Example, if you don't like the default LookAndFeel of Java, change it according to
your like because now its your world, its your Java. Let me show you one simple
code change we have done with the gradient color. This
is the normal Ocean LookAndFeel of Java.

Before the code Change:

 

 After the code change:

 

 

Though building OpenJDK is little cumbersome process but come on, its a one time process. Just make the build ready once and then screw it as you want both on the Java level and on native level . Even more process and standard documents will come as OpenJDK goes into its maturity stage. You will love to know that Netbeans 5.5+ is giving a high class support for making OpenJDK across all platforms.


So for the real die-hard of Java, I am going to write Part II, III, ... upto N(covering some technicalities of building process) till I am not able to make you happy. Thanks to Igor and Sandeep who have replied my all shots of stupid questions.

 

About

Hi, I am Vaibhav Choudhary working in Sun. This blog is all about simple concept of Java and JavaFX.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today