Java

Retrieving Hashmap value by comparing hashmap key

Java
Program: Hashmap.java [java]package com.ngdeveloper.com; import java.util.HashMap; import java.util.Map.Entry; public class Hashmap { public static void main(String[] args) { String keyword="super"; HashMap<String, String> myMap = new HashMap<String, String>(); myMap.put("super", "java keyword"); myMap.put("array_merge", "php array function"); for (Entry<String, String> pair : myMap.entrySet()) { if(pair.getKey().equalsIgnoreCase(keyword)){ System.out.println(keyword+" is: " + pair.getValue()); } } } }[/java]   Output: super is: java keyword Thanks for reading this post.......!!!

Maven Installations and configurations

Java
Step 1: Go to the link below download the maven file. http://www.apache.org/dyn/closer.cgi/maven/binaries/apache-maven-3.0.4-bin.tar.gz Step 2: Just extract the file and put it in the D drive or where ever you want. Step 3: Now go to the command prompt, and type mvn and you will get as follows, Because we haven’t set the maven path. Step 4: Now set the path as follows and you will get the output as follows, set M2_HOME=D:\apache-maven-3.0.4 (path of our maven extracted file) set PATH=%PATH%;%M2_HOME%\bin  %PATH% to maintain the already set paths. Note: do not put semicolon at the end of set path statement, because of semicolon at the end you might not get the output sometime. Now we can work with maven.   Thanks for reading this post..

Ant Installations and Configurations

Java, Tools
Step 1: Before installing ant ensure that already java has been installed in your system. Step 2: Go to the below link and download the ant. http://ant.apache.org/bindownload.cgi Step 3: Just extract the zip file you downloaded and put in the drive you want. Step 4: Now go to the command prompt and type ant then you will get like as follows, Step 5: Now we will set the environment path for ant in the command prompt, set ANT_HOME=D:\apache-ant-1.8.4 set JAVA_HOME=C:\Program Files (x86)\Java\jdk1.6.0 set PATH=%PATH%;%ANT_HOME%\bin;%JAVA_HOME%\bin If you type ant in the command prompt then the window will appear like as follows, Then you can start working with ant.   Thanks for reading this post..............!!!

Java Path Set

Java
Way 1: Setting using System properties Step 1: Right click on computer – > properties – > Advanced system settings – > Advanced – > Environment Variables – > User variables. Step 2: Create New and type as follows, variable: CLASSPATH value : c:\Program Files\Java\jdk1.6.0\jre\lib variable: JAVA_HOME value : C:\Program Files\Java\jdk1.6.0 variable: PATH value : C:\Program Files\Java\jdk1.6.0\bin; Way 2: Setting in the Command prompt Step 1: Just go to start and type cmd, then command prompt will be opened. Step 2: Now type as follows, set JAVA_HOME = C:\Program Files\Java\jdk1.6.0 set PATH = %PATH%;C:\Program Files\Java\jdk1.6.0\bin; set CLASSPATH = c:\Program Files\Java\jdk1.6.0\jre\lib Step 3: Check by typing javac in the com