Tag Archives: java
Search Google Programmatically with Java

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL;   public class Google_Search { private final String _url; private…

Call Google Search API in Java

We will need gogole-gson, a Java library that can be used to convert Java Objects into their JSON representation. It…

List all running processes in Java

Tasklist displays a list of applications and services with their Process ID (PID) for all tasks running on either a…

Convert Byte[] array to String in Java

Let’s see how we can convert a byte array to a string using Java. Code String ex = "example"; byte[]…

Open source java library for libpcap and winpcap

jNetPcap is an open-source java library. It contains: A Java wrapper for nearly all libpcap library native calls Decodes captured…

Add a trailing slash in path if not exists – Java

String path = "/path/to/folder"; if(path.charAt(path.length()-1)!=File.separatorChar){ path += File.separator; }String path = "/path/to/folder"; if(path.charAt(path.length()-1)!=File.separatorChar){ path += File.separator; }

Save user settings in Java application

Class: import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.Properties;     public class configManager { private Properties _properties;…

Check if file or directory exists in Java

Check if file exists: File f = new File("/path/to/filename"); if(f.exists()){ .. }File f = new File("/path/to/filename"); if(f.exists()){ .. } Check…

Encrypt string using AES 128 – Java

You need Apache Commons Codec. package encryption.aes;   import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException;…

Capture screen shot in Java

It’s really easy to capture screen shots using java code. Let’s see how: 1 2 3 4 5 6 7…

Next Page