Posts

Showing posts with the label hello world java

How to pass key-value parameter on command line - JAVA

How to work with  key value pair during running the program from command line. See the below example public class  Example {     public static void main(String[] args)     {         String name = System.getProperty( "name" );         String age = System.getProperty( "age" );         System.out.println(name + " : " +age);     } } Syntax to run above program c:/> java < -Dkey=value>  <classname> Explanation java = command to run the program -Dkey=value  = should always start with -D and then key and value, note there should not be any space in between. classname =class name So once you compile the program, below is how you can run  c:/> java -Dname=Umesh -Dage=30 Example output Umesh : 30 compiled and run on java 1.8

Java Installation on Windows System

Image
Java is a very simple programing language. Just you need to understand the real world you can understand Java. To learn Java Technology you don’t need any other programming language to learn first. Best feature of Java Technology Simple Pure Object Oriented Platform Independent Portable Dynamic Secure Distributed and High Performance Ready your system for Java Download latest JDK. Click here to download Install JDK. Set Path : go to bin folder of installed java directory, copy the path and add into your system’s environments variable. Example : suppose bin path is C:\Program Files\Java\jdk1.7.0_15\bin then copy this path and add  in environment variable->path. Note : if semicolon is not added at last then first add semicolon then path. Do not remove system’s path, just add in the last. 4.  Now you can test that jdk is installed in you system or not. Open command prompt  Type javac command and press enter. If java description is showing...