Get System environment variable details.
import java.util.Map;
/**
*
* @author Uttesh Kumar T.H.
*/
public class FindJdk {
public static void main(String[] args) {
Map<String, String> env = System.getenv();
for (String envName : env.keySet()) {
System.out.format("%s=%s%n",envName,env.get(envName));
...
Thursday, February 26, 2015
Command execution by Java Processor
sample code to execute any command on operating system by using java processor.
for example :
To find jdk installed in system, We can run the command "where javac" for window and "where is javac" for linux
the above command will return path javac.exe/javac.bin, by using that path we have to go to...
Wednesday, February 25, 2015
6 Steps for contribute your jar/project to open source maven repository

Prerequisites:
1. Sign Up at Sonatype.
2. Create your project in JIRA.
3. Create a Key Pair.
4. Create and Sign your Artifacts.
5. Deploy your Artifacts to your Staging Repository.
6. Promote your Repository
Step...
Monday, February 23, 2015
Whois domain detail by java
Apache commmon org.apache.commons.net.whois.WhoisClient class provides the domain details.
Following details:
Domain Name: UTTESH.COM
Registrar: GODADDY.COM, LLC
Sponsoring Registrar IANA ID: 146
Whois Server: whois.godaddy.com
Referral URL: http://registrar.godaddy.com
Name Server: NS63.DOMAINCONTROL.COM
Name...
JAVA8 Lambda part1
Lambda expressions are a new and important feature included in Java SE 8. Lambda expressions also improve the Collection libraries making it easier to iterate through, filter, and extract data from a Collection. In addition, new concurrency features improve performance.
Lambda Expression Syntax
(Arguments)...
Thursday, February 19, 2015
Maven Copy dependency jar files/ get dependency jar file to custom location
Added the below plugin in the pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
...
Exciting Features In Java 8 That Will Change How We Code?
5 features that we feel an absolute must for you to know about.
1.Lambda expressions.
2.Parallel operations.
3.Java + JavaScript :)
4.New date / time APIs.
5.Concurrent accumulators
1.Lambda expressions
Lambda expressions have taken the programming world by storm in the last few years. Most modern...
Tuesday, February 17, 2015
Is in Daylight Saving Time (DST)? for given date and timezone
Daylight Saving Time (DST) is the practice of turning the clock ahead as warmer weather approaches and back as it becomes colder again so that people will have one more hour of daylight in the afternoon and evening during the warmer season of the year.
i.e In the spring when DST starts (= lose one...
Screen capture by Java robot class
Came across a rare util class of java "Robot" class, which provie the control/auto typing of letter/keyboard controll and screen capering.
sample code
This file contains bidirectional Unicode text that may be interpreted or compiled...
Monday, February 16, 2015
Read multiple xml nodes by JAXB / converting xml to object
Using JAXB we can read/write the multiple xml nodes.
consider a scenario where u have to read the list of items from the file system, then its better option is to use JSON or XML structure.
Full sample of the JAXB reading the list of object from the xml file.
...
JAXB sample
JAXB, stands for Java Architecture for XML Binding, using JAXB annotation to convert Java object to / from XML file.
No need of external jar library files. JAXB is bundled in from JDK 1.6.
Basic features :
Marshalling – Convert a Java object into a XML file.
Unmarshalling – Convert XML content into...
Wednesday, February 11, 2015
MAVEN : Resolve duplicate or find dependency jar in POM file

To resolve the duplicate jar file in target/war and finding the dependency tree jar file in maven.
Run the below command
mvn dependency:tree
result :
by analyzing the jar file dependency tree we can...