Java Programming Archive

xPath Processing for XML documents using Java

As defined earlier, XPath is a language for finding and searching information in an XML document using Path Expressions which is similar to the file system syntax. 1 If you can using Eclipse or other IDE, you may create a new project. 2 Create a new class named : ReadXPath 3 Copy ...Read More

Database Porgramming : Creating a simple phone book using Java & a database ( HSQLDB )

In one of the last tutorial, we have created a simple phonebook system using a text file and Java Programming. For more details, click here. In this tutorial, we will be creating the same project but with the integration of a simple database management system called ( HSQLDB ). The program will ...Read More

Java & HSQLDB : Connecting to a DBMS (HSQLDB) from Java Program

1) Create a simple file and call it Simple.java. Here is a simple code written in Java to connect to a DBMS : import java.io.*; import java.sql.*; import java.util.*; public class Simple { public static void main(String args) { Connection con=null;; try { Class.forName("org.hsqldb.jdbc.JDBCDriver"); con=DriverManager.getConnection("jdbc:hsqldb:mydbb","SA",""); con.createStatement().executeUpdate("SET DATABASE SQL SYNTAX MYS TRUE"); con.createStatement().executeUpdate("create ...Read More

Java Programming : Creating a Phonebook using a simple CSV file

In this tutorial, we will create a simple phonebook system using a text file. This is without accessing or using any advanced database management system like Access, MySQL or Oracle. The program will be a textual interactive application without a graphical interface for the sake of simplicity ! We will be having ...Read More

Installing & Configuring Java Development Kit ( JDK )

1. You need to download the Java Development Kit ( JDK ) from Oracle website.    http://www.oracle.com/technetwork/java/javase/downloads/index.html 2. Double click on the downloaded file [jdk-7-windows-i586.exe]   3. Click : Start -> right click on Computer -> click on Properties   4. Click on Advanced system settings 5. Click on Environment Variables 6. Choose ...Read More

Reading from a text file using Java

1. Open your Eclipse and remember the location of your workspace 2. Create a new Project : MyReadFileProj  [ Click here for steps to create a new project ] 4. Right Click on MyReadFileProj : New -> File 4, Type the name of the text file as :  data.txt A,B,222222 C,D,223333 F,T,999999 ...Read More

Java Simple Program to write text data to a file

1. Open Eclipse and REMEMBER the workspace location 2. New project : MyWriteFileProj   [ Click here for steps to create a new project ] 3. New Class under the project : MyWriteFile 4. Type in the following code under your class : MyWriteFile import java.io.*; public class MyWriteFile { public static void ...Read More

Java Programming : Creating a simple java project using Eclipse

In this tutorial, we will learn how to read and write a simple text to a file. 1. You need to open your Programming Editor [ Eclipse ] 2.  Under Eclipse, Click : File ->Project   3. Select Java Project 4. Type in the name of the project: ReadWriteFile   5. Right ...Read More