Compiling and Running Application

We created a directory structure under E:\ajp\hib (hereafter referred to as hibernate_home) shown in Figure 23.2: The directory book contains the file Book.java and SaveBook.java and hibernate-release-4.3.1.Final folder contains Hibernate API. The JAR file mysql-connector- java-5.L26-bin.jar contains MySQL drivers.

Go to the hibernate_homebook directory and use the following command to compile SaveBook. java:

javac -cp ..\hibernate-release-4.3.1.Final\lib\required\*;. SaveBook.java

Now, run this application using the following command:

java -cp ..\hibernate-release-4.3.1.Final\lib\required\*;..\mysql-connector-

java-5.1.26-bin.jar;. SaveBook

You may check if the application really added a row in the table book as follows:

Source: Uttam Kumar Roy (2015), Advanced Java programming, Oxford University Press.

Leave a Reply

Your email address will not be published. Required fields are marked *