Sunday, March 15, 2015

How to Pass Java Command-Line Arguments in Netbeans IDE

Java application can accept any number of arguments from the command line. Here you will be guide how to input command line arguments  in Netbeans IDE. 

1. Simple Java code "HelloWorld.java"
package helloworld;
public class HelloWorld {    
    public static void main(String[] args) {    
        System.out.println("number of input "+args.length);      
        for (String i : args) {
            System.out.println(i);            
        }     
    }
}
 2. How to input arguments. 

  • File --> Project Properties(<file name>) 


  • Select "run"


  • Enter inputs (arguments) in Arguments text field. Separate each arguments by space and click "ok".
  • Note: If you enter argument including double quotes it takes as a single argument even-though separated by space. 
    • Ex: "go run went"  is  taken as single argument
    • Ex: go run went  <---- taken as multiple arguments.

3. Output

  • Run --> Run Main Project or press shortcut key F6.



Sunday, March 1, 2015

WebGL

What is WebGL ?

WebGL  stands for Web Graphic Library. WebGL is a JavaScript API which supports 3D computer Graphics and 2D Graphics on the web browser. Mozilla Firefox , Google Chrome, Opera, Apple Safari(WebKit) are some of them which supports WebGL without any plug-ins in the desktop environment and Chrome for Android and Firefox for Android  are some of them in the Mobile environment. WebGL is designed and maintain by Khronos Group (American not for profit member funded industry consortium).

WebGL program consists of control code and shader code. Control code is written in JavaScript and Shader code is executed on a computer's Graphic Processing Unit(GPU).

Does my Browser support WebGL?

You can check whether your browser supports WebGL or not. Here are some experiments. Following function gives a 3D Graph which display rotating heart.


Similar technologies for 3D in a Browser:
  • Java OpenGL
  • Stage3D
  • Google Native Client