Simple way of doing Date conversion from String is by using java.text.SimpleDateFormat. Here’s an extract of relevance from the javadoc, listing all available format patterns: G Era designator Text AD y Year Year 1996; 96 M Month in year Month July; Jul; 07 w Week in year Number 27 W Week in month Number 2 D Day in year Number ... Read More »
Java Core
Getting System Out to Write to a Particular File on System
This tutorial redirects the System.out to a file provided by the user. Steps to follow – 1. Create a file myconsole.txt.2. Create a PrintStream that uses FileOutputStream3. Set the System Out with PrintStream object. Read More »
How to do Reverse DNS (rDNS) lookup in java
What is Reverse DNS Lookup Reverse DNS lookup or reverse DNS resolution (rDNS) is the determination of a domain name that is associated with a given IP address using the Domain Name System (DNS) of the Internet. Computer networks use the Domain Name System to determine the IP address associated with a domain name. This process is also known as ... Read More »
Executing Operating System/ Shell Commands In Java
In Java, you can execute external OS/shell commands. There are two ways to start an operating system process/execute shell command within Java: java.lang.Runtime#exec(java.lang.String), since Java 1 java.lang.ProcessBuilder, since Java 5 We will here show you both ways to execute Operating System/ Shell Commands 1. Using java.lang.Runtime The java.lang.Runtime class allows the application to interface with the environment in which the ... Read More »
How To Use HttpClient
This java based tutorial is designed to provide a basic overview of how to use HttpClient. Downloaded HttpClient and dependencies listed below that are required to put them on your classpath. httpclient-4.2.3.jar from http://hc.apache.org/downloads.cgi/li> commons-codec.jar from http://commons.apache.org/codec/ commons-logging.jar from http://commons.apache.org/logging/ junit.jar from http://www.junit.org/ The general process for using HttpClient consists of a number of steps: Create an instance of HttpClient. ... Read More »
How To Set Fake User Agent
How to set fake user agent What is user agent? User agent is software agent that is acting on behalf of a user. For example, an email reader is a mail user agent, and in the Session Initiation Protocol (SIP), the term user agent refers to both end points of a communications session. User agent acts as a client in ... Read More »
How To Avoid Memory Leak in Java
How to avoid Memory leak issue in Java What is Memory Leak? Memory leak mainly occurs when a program does not release the memory it has obtained for temporary use, it is the condition where the available computer memory reduces gradually there by resulting in poor performance. How to determine if Memory Leak exists in a Java application?If the application ... Read More »
Merge PDF Files in Java Using iText API
Java programme to merge different PDF files. This uses the iText API to read and merge PDF files What is iText? iText is a library that allows you to create and manipulate PDF documents. It enables developers looking to enhance web and other applications with dynamic PDF document generation and/or manipulation. You can create PDF documents from scratch with data ... Read More »
Unix epoch time from Java Date object
What is epoch time? The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds (in ISO 8601: 1970-01-01T00:00:00Z). Literally speaking the epoch is Unix time 0 (midnight 1/1/1970), but ‘epoch’ is often used as a synonym for ‘Unix time’. Many ... Read More »
Unix epoch time to Java Date object
What is epoch time? The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds (in ISO 8601: 1970-01-01T00:00:00Z). Literally speaking the epoch is Unix time 0 (midnight 1/1/1970), but ‘epoch’ is often used as a synonym for ‘Unix time’. Many ... Read More »
Jkoder.com Tutorials, Tips and interview questions for Java, J2EE, Android, Spring, Hibernate, Javascript and other languages for software developers