Archive

Archive for October, 2013

Ant Primer

October 25, 2013 Leave a comment

 

 

apache ant 

 

Ant Origin:

Ant was conceived by James Duncan Davidson while turning a product from Sun into open source. That product, Sun’s reference JSP/Servlet engine, later became Apache Tomcat. A proprietary version of Make was used to build it on the Solaris Operating Environment, but in the open source world there was no way of controlling which platform was used to build Tomcat. Ant was created as a simple platform-independent tool to build Tomcat from directives in an XML “build file”. From this humble beginning, the tool has gone on to become more widespread than the Tomcat product for which it was created. Ant (version 1.1) was officially released as a stand-alone product on July 19, 2000. Today, Ant is the build tool used by most Java development projects. Most open source developers include build.xml files with their distribution.

 

Ant Introduction:

In recent years, Open Source tool Ant has become the de facto standard for building Java projects. Like its venerable ancestor Make, Ant controls the steps necessary to compile, package, and arrange the files that make up your development project. Built with Java, Ant has been designed to be easy to use, flexible, and platform independent.

Apache Ant is an Apache Jakarta project. It is open source software, and is released under the Apache Software License. It is a java-based tool for automating software build processes. It is similar to Make but is implemented using the Java language, requires the Java platform, and is best suited to building Java projects. The most immediately noticeable difference between Ant and Make is that, Ant uses XML to describe the build process and its dependencies, whereas Make has its Makefile format. By default the XML file is named build.xml.

All modern Java IDEs integrate with it, most open-source Java projects use it. If you are developing Java software and not using Ant, then chances are you’re doing things the hard way. It’s relatively easy to craft an Ant build file by cutting and pasting pieces from other build files, but we don’t want to get into a situation where maintaining the build process is a full-time job. It is important to understand Ant’s capabilities in order to avoid hacking build files. By understanding Ant’s basic data types, syntax, and properties and applying some simple best practice techniques, the build process can be easily controlled, extended, and reused.

ANT enables you to automate the build deploy process of your server-side Java Web components as well, such as custom tags, servlets, and JSPs. Ant gets its cross-platform support by relying on Java for file access, compilation, and other tasks. Ant is extensible through its support for scripting (Jython and NetRexx, among others), Java custom tasks, and the ability to call OS commands, executables, and shell scripts via an Ant exec task (normally a lastresort measure). Ant makes continuous integration possible for server-side components with its automated build script and integration with JUnit, a unit-testing framework for Java. Read more…

Advertisements

Why Ant?

October 15, 2013 Leave a comment

 

 

Imagine that you are working on a large project. The project is a Java project and consists of many .java files. It consists of classes that are dependent on other classes and classes which are stubs or drivers, they are situated in multiple directories and the output files must go into multiple directories too. Suppose you have to perform obvious operations with the .java files as:-

  • Compile the .java files.
  • Put the .class files in a directory.
  • Put the .class files in a .jar.
  • Put all the html/jsp/css and other web files in one directory and package them in .war
  • Package all the third party libraries and dependancies into another .jar
  • Package all the .jars, .wars into .ears for deployment
  • Clean all the directories before every use so that you get fresh compiled versions or packaged structures.

Suppose you are coordinating all of this manually or using some other build utility which doesn’t do what you want it to (which is automate it exactly), then many hours are spent changing directories compiling individual files and so on. All these above operations fall under building and/or deploying a project. Now, imagine if there was a tool that could alleviate the stress and hassle you are experiencing and automate the complete process. Such a tool exists and its called ANT. Before Ant, building and deploying Java applications required a hodgepodge of platform-specific scripts, makefiles, proprietary IDEs, or manual processes. Now, nearly every open source Java project uses Ant. A great number of companies use Ant for internal projects as well.

Ant (originally an acronym for Another Neat Tool), is a java-based build tool with special support for the Java programming language but can be used for just about everything. In theory, it is kind of like make, without make‘s wrinkles. Ant automates software build processes. It is similar to Make but is implemented using the Java language, requires the Java platform, and is best suited to build Java projects.

 

Few of Ant’s features:

  • Ant is platform-independent and hence Cross-platform.
  • It is written purely in Java.
  • Ant is particularly good at automating complicated repetitive tasks and thus is well suited for automating standardised build processes.
  • Ant accepts instructions in the form of XML documents thus is extensible and easy to maintain.
  • More popular than ‘make’ for building Java projects
  • Updated and improved regularly
  • Straightforward XML syntax
  • Plug-in oriented architecture encourages expansion
  • Directly supported by some IDEs (with more coming)
  • Free and open source Read more…
Categories: Why Ant? Tags: , , , ,

Java Terminologies

October 10, 2013 1 comment

 

Few terminologies to be familiar with, before getting started with Java:

 

Java Platform:

The Java platform from Sun allows developing and running programs written in the Java programming language. The platform is not specific to any one processor or operating system, but rather an execution engine called virtual machine and a compiler with a set of standard libraries that are implemented for various hardware and operating systems so that Java programs can run identically on all of them.

The Java Platform consists of several programs, each of which provides a distinct portion of its overall capabilities. For example, the Java compiler converts Java source code into Java byte-code, an intermediate language to be executed by the virtual machine (JVM) and it is provided as part of the Java Development Kit (JDK). The Java Runtime Environment (JRE), complementing the JVM with a just-in-time (JIT) compiler, converts intermediate byte-code into native machine code on the fly. Also supplied are extensive libraries, pre-compiled in which are several other components, some available only in certain versions.

The essential components in the platform are the Java language compiler, the libraries, java language itself (Java API) and the runtime environment in which Java intermediate byte-code “executes” according to the rules laid out in the virtual machine specification. 

  Java Platform

JVM:

The heart of the Java Platform is the concept of a “virtual machine” that executes Java byte-code. This byte-code is the same no matter what hardware or operating system the program is running under. The use of byte-code as an intermediate language permits Java programs to run on any platform that has a virtual machine available. Although Java programs are platform independent, the code of the Java Virtual Machine (JVM) that execute these programs is not so every supported operating platform has its own JVM.

The JVM is a crucial component of the Java Platform. It is a platform-independent execution environment that converts Java byte-code into machine language and executes it. Most programming languages compile source code directly into machine code that is designed to run on a specific microprocessor architecture or operating system, such as Windows or UNIX.

The JVM is an instance of the JRE (Java Runtime Environment) and comes into action when a Java program is executed. JVM can be obtained with JRE / JDK distribution.

Few functionalities of JVM are:-

  • Loading of class files (compiled java source code).
  • Verification of class files i.e., Class files should contain valid byte-code.
  • Interpretation of byte code and then run the program. 

  

JIT: Read more…

MySql Installation & Configuration

October 6, 2013 1 comment

 

 

At the time of this post, the current release is MySQL 5.1 – Generally Available (GA) release for production use and is the recommended version, though MySQL 5.4 is available to download as Beta release. When preparing to use MySQL, you should decide the version to go ahead with. After deciding which version to install, you can choose a distribution format. Releases are available in binary or source format.

The first decision to make is whether you want to use a production (stable) release or a development release.

  • MySQL 5.4 is the current development release series.
  • MySQL 5.1 is the current General Availability (Production) release series. New releases are issued for bugfixes only; no new features are being added that could affect stability.
  • MySQL 5.0 is the previous stable (production-quality) release series.
  • MySQL 4.1, 4.0, and 3.23 are old stable (production-quality) release series. MySQL 4.1 is now at the end of the product lifecycle. Active development and support for these versions has ended.

If you are beginning to use MySQL for the first time or trying to port it to some system for which there is no binary distribution, go with the General Availability release series. Currently, this is MySQL 5.1.

After choosing which version of MySQL to install, you should decide whether to use a binary distribution, or a source distribution. In most cases, you should probably use a binary distribution.

Binary distributions contain a setup program that installs everything you need so that you can start the server im-mediately. Another binary distribution format contains an archive that you simply unpack in the installation location and then con-figure yourself. The source distribution contains all the code and support files for building the executables using the Visual Studio compiler system.

New MySQL users can use the Binary distributions (which contains the MySQL Installation Wizard and MySQL Configuration Wizard) to install MySQL. These are designed to install and configure MySQL in such a way that new users can immediately get started using MySQL.

 

 

Pre-Requisites:

Please note that not all platforms are equally suitable for running MySQL, and that not all platforms on which MySQL is known to run are officially supported by Sun Microsystems, Inc. AIX 4.x / 5.x, FreeBSD 5.x, HP-UX 11.x, Linux, Mac OS X, Solaris 2.8, Windows 2000, Windows XP, Windows Vista, Windows Server 2003, and Windows Server 2008 are the platforms supported.

 

  

Download Instructions: Read more…

JDK 7 With Danny Coward

 

 

Just recently we had a post about Java versions, and timely SDN has given us a precious insight into JDK 1.7. As Ed Ort candidly speaks to Danny Coward about the venture, Danny reveals few of the new functionalities that will be incorporated in JDK 1.7.

 

Vodpod videos no longer available.

 

Guest Host/Blogger: Ed Ort, Senior Staff Information Engineer, Sun Microsystems
Guest: Danny Coward, Chief Architect for Client Software at Sun Microsystems
August 20, 2009

 

SDN Quotes:

Learn about some of the new and cool features in the next release of the Java Development Kit, JDK 7. In this Deep Dive, Danny Coward, Chief Architect for Client Software at Sun Microsystems, highlighted some of the significant new features in JDK 7. Some of these features focus on modularizing the JDK, supporting non-Java languages at the VM level, and making developers more productive through various small changes to the Java languages. Danny backed up this discussion with some code examples and demonstrations.

 

Few prominent features of JDK 1.7: Read more…