TheaSolutions Home
Home
Saturday Aug 09, 2008

Signing a Jar file

Signing a jar file is essential to launch programs thorugh JNLP/ Java Webstart. Let us discuss in brief how to sign a jar file. JDK is to be installed and ensure the bin folder under Java installation home folder has  keytool.exe and jarsigner.exe [To ensure you have JDK and not just JRE] and are available in the PATH [in windows].

Assuming the algorithm used to generate key is RSA, execute the following command navigating to the directory in which jar file resides[let us assume the name of the jar file to be signed is myapp.jar].

keytool -genkey -alias keystorename -keyalg RSA -keypass urpassword -keystore appkeystore.jks -storepass urpassword

You will be prompted to enter values for your state, oraganisation etc. Enter appropriate values and then execute the following commandto complete the signing of the jar file.
jarsigner -keystore appkeystore.jks   myapp.jar keystorename

JavaFX Tutorial 1 - Linear Gradient

 The below example uses NetBeans release with JavaFX. Incase you have not installed NetBeans, please refer the link below

http://www.theasolutions.com/roller/javajee/entry/javafx_part_1_getting_started

Create a new JavaFX project [File--> New Project]. By default Main.fx file is created as the starting point of the application. Copy paste the below code into Main.fx.

 /**
 * @author karthikeyan c
 */

import javafx.application.*;
import javafx.scene.geometry.Rectangle;
import javafx.scene.paint.Color;
import javafx.scene.paint.LinearGradient;
import javafx.scene.paint.Stop;
import java.lang.System;
import javafx.scene.effect.light.*;

Frame {
    stage:Stage {
          
        content: [
 
            Rectangle { x:0 y:0 width:1000 height:700 arcWidth:20 arcHeight:20
                fill:LinearGradient {
                    startX:0 startY:0 endX:0 endY: 1
                    stops: [
                        Stop { offset:0 color:Color.web("#A1B8BF",1) },
                        Stop { offset:0.05 color:Color.rgb(0,0,0,1)},
                        Stop { offset:0.25 color:Color.web("#2E2A2A",1)},
                        Stop { offset:0.85 color:Color.web("#171715",1)},
             
                        Stop { offset:0.98 color:Color.web("#607980",1) },
                        Stop { offset:1 color:Color.web("#000000",1) },
                           
                    ]
                }
                   
            }
        ]
    }
    visible: true
               
}

Note that visible:true is important.If we do not include it, the frame will not be visible.

You can also specify the color using RGB as below (instead of HEX value as in the above code)
Stop { offset:0.05 color:Color.rgb(0,0,0,1)},

 The 1 at the end denotes the alpha value to be applied. Try to change the color values and also the offset  it should start [which are 0,0.05,0.25,0.85,0.98 and 1 in the above code]

In the next tutorial let us place some input types on the stage.

Home
Friday Aug 08, 2008

About missing javafx.ui package

This post is just to inform JavaFX starters that javafx.ui package is no more valid. Instead we have to make use of javafx.ext.swing and javafx.application packages

Most of the JavaFX examples on the internet  make use of javafx.ui package which is not available in the preview release of JavaFX SDK. Hence those examples will not compile [for example in NetBeans 6.1 with JavaFX release]

JavaFX - Getting Started

The best way to get started is download NetBeans 6.1 with JavaFX release.

Click to download NetBeans 6.1 with JavaFX release

Note:  You may visit www.javafx.com verify if any update is available for NetBeans with JavaFX as the above link may become obsolete in future.