You are here: Community > Working With Source Code > Sharpen > How To Setup Sharpen

How to Setup Sharpen

You can obtain sharpen source from db4o svn repository at:

https://source.db4o.com/db4o/trunk/sharpen

For the ease of use check-out sharpen projects:

Additionally Sharpen requires a valid Eclipse installation to run. Install Eclipse on your machine or reuse an existing installation. Check out the four projects into the same workspace as your java project which you want to convert. This is not required is easier to use and maintain.

The first step is to build sharpen. For that we can use Apache Ant:

<target name="build-sharpen">
    <property name="sharpen.core.dir" location="${dir.workspace}/sharpen.core"/>
    <reset-dir dir="${dir.dist.classes.sharp}"/>

    <javac fork="true"
           debug="true"
           target="1.5"
           source="1.5"
           destdir="${dir.dist.classes.sharp}"
           srcdir="${sharpen.core.dir}/src"
           encoding="UTF-8">
        <classpath>
            <fileset dir="${eclipse.home}/plugins">
                <include name="org.eclipse.osgi_*.jar"/>
                <include name="org.eclipse.core.resources_*.jar"/>
                <include name="org.eclipse.core.runtime_*.jar"/>
                <include name="org.eclipse.jdt.core_*.jar"/>
                <include name="org.eclipse.jdt.launching_*.jar"/>
                <include name="org.eclipse.equinox.*.jar"/>
                <include name="org.eclipse.core.jobs_*.jar"/>
            </fileset>
        </classpath>
    </javac>
    <jar destfile="${dir.dist.classes.sharp}/sharpen.core_1.0.0.jar" basedir="${dir.dist.classes.sharp}">
        <fileset dir="${sharpen.core.dir}">
            <include name="plugin.xml"/>
        </fileset>
    </jar>
</target>
sharpen-install.xml: Build Sharpen

To run Sharpen you should install it to an Eclipse instance:

<target name="install-sharpen-plugin" depends="build-sharpen">
    <copyfile src="${dir.dist.classes.sharp}/sharpen.core_1.0.0.jar" dest="${plugins.home}/sharpen.core_1.0.0.jar"/>
</target>
sharpen-install.xml: Install Sharpen to Eclipse

Put the paths for the build in a property file, so that you can easily change them. Here's a example of the property file. You have to configure the JDK-path, the Eclipse path and the path to the Sharpen source.

#The workspace where the sharpen projects are
dir.workspace=C:/Users/Gamlor/Develop/db4o/sharpenProject
# Java executable
jdk.home=${env.JAVA_HOME}
jdk.home.java=${jdk.home}/bin/java.exe
# Eclipse home directory
eclipse.home=C:/progs/eclipse
# Sandcastle can be used to convert javadoc to .NET xml comments
# dir.lib.sandcastle=e:/sandcastle/
# sharpen compile directory
dir.dist.classes.sharp=${dir.workspace}/dist/
# Eclipse plugins home
plugins.home=${eclipse.home}/plugins
sharpen.properties: The configuration for building sharpen

After that Sharpen is set up to run. Download the example build script here.