Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Find the answer to your Linux question:
Site Navigation
Linux Forums
Linux Articles
Product Showcase
Linux Downloads
Linux Hosting
Free Magazines
Job Board
IRC Chat
RSS Feeds
Free Publications


In this tutorial we will cover the installation and the configuration of Java, NetBeans, MySQL and GlassFish for web and stand-alone applications

Java has been introduced in the mid nineties as high level programming language. It has since acquired a huge class libraries that other competing languages as  c# do not have in their default installation, they use third party pulgins to utilize the desired functionality. Java is multipurpose, object oriented, secured and is famous for 'write once, run anywhere' (WORA) as its programs run on the Java virtual machine. So it is solely independent from the operating system.

MySQL is the most popular database in the Internet. It is a relational database management system. MySQL is deployed in many famous websites including Facebook, Wikipedia and Twitter. It is fast, reliable and easy to use, has many graphical user interface softwares (GUI) (e.g. MySQL query browser,, MySQL workbench,....etc) and it is open source(free). GlassFish is an open source application server. I have chosen it to be my application server as I have tested it against JBoss  and Apache Tomcat and GlassFish has outperformed them in terms of speed and has more informative error messages than the other two.

To set up the environment at first you need to install Java development kit(JDK) and Java virtual machine (JVM). In Ubuntu 11.10 you will not find those in Ubuntu Software center (God I miss synaptic!) so make sure that you are connected to the Internet and type the following:


$sudo apt-get install openjdk-7-jdk openjdk-7-jre



Then go to Ubuntu Software Center and type in the search filed MySQL and download and install MySQL server. You may want a graphical tool (like one of the mentioned above) to make using the Mysql server much easier. Then type:


$sudo apt-get install libmysql-java



After that go to (www.netbeans.org) and download the latest version of NetBeans IDE for Linux distributions(it will have '.sh' extension). Once the download is completed right click  on the downloaded NetBeans file and click on properties then click on permissions tab and tick on the execute box. After that, double click the file and follow the on-screen instruction and add JEE to the installation and choose your favourite webserver (my personal advice is GlassFish). My main reason for choosing NetBeans over Eclpsie is that the GUI builder in NetBeans  is  far way better from the free eclipse GUI builder. And as I use the prototyping methodology when building systems I find that Eclipse free editors are from the Stone Age and they waste very valuable time. There are some good visual editors for Eclipse like Jigloo but they are commercial. However, Eclipse is more powerful than NetBeans. If you excluded the GUI issue. At the end you are free to choose any of those two IDEs .

Now in this step we will 'bridge' Mysql with java and GlassFish by using mysql-connector-java (connector/J). Download from (http://www.mysql.com/downloads/connector/j/) and extract the latest version of the connector and do the following:

1- Copy mysql-connector-java-5.1.18-bin.jar to /usr/share/java by opening a terminal and typing:

$sudo cp /pathtoMysqlConnectorJ/mysql-connector-java-5.1.18-bin.jar /usr/share/java/mysql-connector-java-5.1.18-bin.jar



2-specify the class path by opening a terminal and type:
$export set CLASSPATH=/path/mysql-connector-java-[ver]-bin.jar:$CLASSPATH
 in our example it should look like this:

$export set CLASSPATH=/usr/share/java//mysql-connector-java-5.1.18-bin.jar:$CLASSPATH




3-copy the connector jar file from its source to the glassfish folder. Try to do this manually by simple copy and paste. But if it did not work type the following:

$sudo cp /originPath/mysql-connector-java-5.1.18-bin.jar /destinationPath/glassfish


4- If for any reason step number (2) was not successfully configured, run NetBeans and create a project and a new package for source code within the project and right click the package then select Properties then click on Libraries and add MySQL JDBC Driver (by clicking add a library and choosing from a list). Secondly, click on add a jar/folder and browse to your mysql-connector-java-[version] which is (5-1-18) in our case. And that's it! Now you can start developing your server/desktop application or your web application.

In the next article I will review the latest Ubuntu operating system which is Ubuntu 11.10.




Author Profile

My name is Amin Salim and I am Sudanese born in Kuwait. I hold a degree in Information Systems (BSC) from the University of Leeds. I have worked as a research assistant for a local expertise and consultancy firm called (SUDEXAM). Then I travelled to Sierra Leone and worked for the project development unit as an Information Systems engineer. My role was doing the financial analysis and the whole editing for the feasibility studies and providing technical support. I am flexible, and a good team player as realized from conducting feasibility studies with people from different backgrounds and qualifications. Afterwards I came back to Sudan and worked as self-employed software engineer and have developed a system by myself from scratch for a charity eye-hospital. The system functionality was to keep track of stock and sales (written in Java). I am very versatile individual as proven from working on different disciplines and always looking to improve my skills.



Rate This Article: poorexcellent
 
Comments about this article

Comment title: * please do not put your response text here