Posts Tagged System

Open Default Browser in Javafx

Hello I’ve seen many of the javafx programmer really likes the facilities of JAVA as everybody likes too. Javafx has capability to run the Java files by using JavaTaskBase, RunnableFuture (Interface). So today I like to present you guys, how can we open the default browser of system from javafx. Let’s begin.


  • Netbeans 6.5 or >
  • Javafx 1.2 or >

Ok Now let’s start with a new project from Netbeans. Start a new project of Java (I’m telling java not javafx). Then create a Java Project name as you want but at here I’m naming it as ‘Browser Starter’ with Java class name ‘BrowserStarter’. Here you have to add a very tiny Java code which opens the Default Browser of System .

package browseropener;

 * @author Narayan
public class BrowserOpener {

    * @param url
    public void open(String url) throws Exception{
        URI u = new URI(url);

Develop Java Jar file

Now that’s all for the Java. You have to do some stuffs . Here we go. Go to properties of your java project and do something like below picture . It will compress your project in jar form then click OK and press “Ctrl F11″ for clean build of your project. Now you will see the jar file being made by Netbeans under <project_directory>/dist . Then copy that jar into specific place where you can use it easily for javafx later.

Create new Javafx project

Now let’s make a new javafx project from Netbeans As shown in figure below. Here we have some tricks which helps to import the jar file we’ve created just before ‘BrowserStarter.jar’ into javafx project.

Creating Library in Netbeans

In this step we are going to create a library so that Netbeans would easily get the java jar file i.e. ‘BrowserStarter.jar’ worked in our javafx project.Let’s see how it works. Go to Project Properties as shown in below.

Now click on Library Category > Add Library. The dialog would appear on window which looks something like this.

Now goto Manage Libraries > New Library again there would come a dialog like below. Here I named the Library Name as ‘BrowserOpener’ and clicked OK.

Ok now it’s time for adding jar files to our Library ‘BrowserOpener’ . Click on Add Jar Folders and specify location where you have kept the Java Project jar file i.e. BrowserStarter.jar

Now you can see our custom Library available in Netbeans Library. Simply click Add Library and it will add the library to your javafx project . Now it’s almost done. You can use this library any time you like in javafx project. Let’s see how javafx works our  library.(Create a main class file  if not exist) I’ve a main file named ‘Main.fx’ in my Javafx project and now i’m going to implement my library to javafx.

package browsertest;

import javafx.stage.Stage;
import javafx.scene.Scene;
import browseropener.BrowserOpener;
import javafx.scene.control.Button;
import javafx.scene.control.TextBox;
import javafx.scene.layout.HBox;

 * @author WEBNEP
def textBox = TextBox {
                    text: ""
                    columns: 12
                    selectOnFocus: true
Stage {
    title: "Application title"
    scene: Scene {
        width: 250
        height: 80
        content: [
            HBox {
                content: [ textBox,

                   Button {
                        text: "Button"
                        action: function() {
                            var opener:BrowserOpener ;
                            opener = new BrowserOpener();



It’s time to compile and run our application. Please run the project by pressing ‘Shift+ F6′ and now there must be application window like below. Click on Button and you ‘ll be able to browse the url on System default browser.

Thanks for watching this blog.
Please don’t hesitate to comment. :) Good day

Tags: , , , , ,

JNode (Open Source Project)

JNode is the open-source project for making a Java Platform OS(Operating System). This project had take a exclusive track of making all the software in Java in itself. As Java Virtual Machine(JVM) only accepts bytecode so the Compiler used to develop native binaries out. In this way, nearly the entire system is able of being written in the JAVA programming Language.

Ewout Prangsma firstly started work of developing the Java Bootable System(JBS) during 1995 .He had caught special feature of Java. In his mind he himself imagined a system that was not only a VM, but a complete runtime environment that does not need any other form of operating system. So is had to be a light weight and most important flexible system. The author was not satisfied with the C and assembly language required and head towards on to a new attempt called JBS2.

Jnode uses only two languages i.e. Java and Assembly Language. This system presently understands the FAT,NTFS,ext2 and ISO 9660 file system. It also has a GUI(Graphical User Interface) with USB peripherals and TCP/IP network protocol. It can be boot from CD or run in any popular emulator. It uses GNU Classpath Java Library and can run any Java Programs.

The latest version of JNode can be found in :

For more Detail :

Tags: , , , , ,

Some of the System Properties of Java

If we want to programmatically determine what version of the Java Runtime Environment

(JRE) is being used to execute a given application then, we can get the version via the following code illustrates:


String ver = System.getProperty("java.version"));
System.out.println("This program is running under JRE version " + ver);</code>

if (ver.startsWith("1.5")) {
     // Pseudocode.
     do something appropriate for newer versions of Java ...

else {
     // Pseudocode.
    do something the pre-5.0 way ...

Some of the java System Properties based on JDK 1.5 are given as follows:

Key Description of Associated Value

java.version Java Runtime Environment version
java.vendor Java Runtime Environment vendor
java.vendor.url Java vendor URL
java.home Java installation directory
java.vm.specification.version Java Virtual Machine specification version
java.vm.specification.vendor Java Virtual Machine specification vendor Java Virtual Machine specification name
java.vm.version Java Virtual Machine implementation version
java.vm.vendor Java Virtual Machine implementation vendor Java Virtual Machine implementation name
java.specification.version Java Runtime Environment specification version
java.specification.vendor Java Runtime Environment specification vendor Java Runtime Environment specification name
java.class.version Java class format version number
java.class.path Java class path
java.library.path List of paths to search when loading libraries Default temporary file path
java.compiler Name of JIT compiler to use
java.ext.dirs Path of extension directory or directories Operating system name
os.arch Operating system architecture
os.version Operating system version
file.separator File separator (/ on Unix)
path.separator Path separator (: on Unix)
line.separator Line separator (\n on Unix) User’s account name
user.home User’s home directory
user.dir User’s current working directory

The following table describes some of the most important system properties BASED on JDK 1.6

Key Description of Associated Value

"file.separator" Character that separates components of a file path. This is
/” on UNIX and “\” on
"java.class.path" Path used to find directories and JAR archives containing class files.
Elements of the class path are separated by a platform-specific character specified in the path.separator property.
"java.home" Installation directory for Java Runtime Environment (JRE)
"java.vendor" JRE vendor name
"java.vendor.url" JRE vender URL
"java.version" JRE version number
"line.separator" Sequence used by operating system to separate lines in
text files
"os.arch" Operating system architecture
"" Operating system name
"os.version" Operating system version
"path.separator" Path separator character used in java.class.path
"user.dir" User working directory
"user.home" User home directory
"" User account name

Tags: , , , ,

ToString() method

The toString() method is one of the feature of java. It is the method of class String which is imported default on JVM from java.lang.Object;

ToString() method is one of the display method.

When ever we tries to print the text from System.out.println("Hello"); then it directly inherit from the toString() method. We can override the toString() method and make the println to print what we desire.
Read the rest of this entry »

Tags: , , , , , , , , ,

Accepting Keyboard Input

First of all we need to know that in java for printing the line we use following command:

While we code the System then it is related with input and output and all the hardware conf.
Then the keyword out defines about the display of the line.
Now we need to input instead of output.
So just code by following ways:;
Read the rest of this entry »

Tags: , , , , , , , ,