"Derby Series" [Beginner-1] Build Derby from source code

Source: Internet
Author: User

Preface

The previous story about Derby and the next step is to start using Derby.
Before you use Derby, of course you install Derby. The simplest way to install is to download the binary release version.
Instead of using this method, I build from the source code.
This article is the second in the Derby series [Beginner], which records the process of building derby from source code.

The OS I use is Windows XP, on the Unix/linux platform, except for the shell type, the syntax for setting environment variables, and the file/directory name specification. Apple's MacOS, as well as Windows installed on the Cygwin, I did not experiment.

1. Download the Derby source code, the current latest version is 10.4.2.0
Unzip to any directory, and later we use ${derby.source} to represent this directory.
Check the files and subdirectories in this directory, and you should have the following:
${derby.source}/build.xml
${derby.source}/bin
${debry.source}/java
${derby.source}/maven
${derby.source}/plugins
${derby.source}/tools

2. Download the required tools and software
1 Installing the Java jdk1.4.x and Java 5 JDK, it is necessary to build the two versions of the JDK for Derby.
Note: In fact, the core of Derby is built on the jdk1.4.x, which keeps backwards compatible. Need to Java5, is to introduce the new language characteristics of JAVA5
The appropriate installation directory is as follows
The JDK1.4 installation directory is later represented by ${jdk14.dir}.
The Java 5 JDK installation directory is later represented by ${java5.dir}.


2 download and install Apache Ant 1.6.x or later (I'm using 1.7.0)
The installation directory is later represented by ${ant.dir}.
3 download JUnit, extract junit.zip files, and copy Junit.jar to ${derby.source}/tools/java directory
I am downloading Junit-3.8.1.jar//Note that if you use the current Junit-4.7.jar, >ant testing will make an error.

4 now check the ${derby.source}/tools/java directory, you should have the following 8 jar files.
${derby.source}/tools/java/empty.jar
${derby.source}/tools/java/geronimo-spec-servlet-2.4-rc4.jar
${derby.source}/tools/java/jakarta-oro-2.0.8.jar
${derby.source}/tools/java/javacc.jar
${derby.source}/tools/java/junit.jar
${derby.source}/tools/java/felix.jar
${derby.source}/tools/java/xercesimpl.jar
${derby.source}/tools/java/xml-apis.jar

3. Configure Environment Variables
1) Set the Ant_home and add anut_home/bin to the PATH environment variable.
--On Window
Set Ant_home=${ant.dir}
Set PATH =%path%;%ant_home%/bin;

2) Configure Java_home
--On Window
Set Java_home=${java5.dir}

4. Build Derby.

The preparations are finally ready, and now we can build Derby.

1) Enter ${derby.source} directory
2 execution >ant under the command line environment
This command will build all Derby classes into the ${derby.source}/classes directory, and if you add this directory to the CLASSPATH environment variable,
You can use all of the features of Derby, including engines, tools, and network server features.
If you want to frame the derby test, use the >ant testing command.
3 Use >ant buildjars command to build all jars files in Derby
-Derby.jar (Database engine),
-Derbytools.jar (Tools: SysInfo, Dblook, IJ)
-Derbynet.jar (network server).
-Derbylocale_*.jar (13 jar files that support different locale).
-Derbyclient.jar (Network client)
If the Derby test is purchased, the following jar file will be built
-Derbytesting.jar (Test framework)

5. Verify that the build is successful
1 Execute >ant command again, this time should what action does not happen, have no file compile, copy and produce.
2 Check the following directory, there should be files inside.
-${derby.source}/classes
-${derby.source}/jars
3 Run Derby's SysInfo Scripting tool, if you can, to illustrate the success of the build.
>JAVA-CP ${derby.source}/classes Org.apache.derby.tools.sysinfo.

6. Supplementing
Build derby with source code, and there are some more in-depth content. For example, the construction process of Derby, some special exception processing and so on.
You can refer to the documentation that is built with Derby. My build process is to refer to the main process of this document step-by-step completion.
Here are a few screenshots of the build process.

Figure one is >ant result, figure two is the result of running SysInfo, Figure 3 is the result of >ant Buildjars.
The test screen has my system information, please do not use this information to attack my computer:-)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.