Duplicate File Finder User Manual

Previous: Introduction    Contents    Next: The Main Window

Part 2:
Installing Duplicate File Finder

Duplicate File Finder requires a Java Runtime Engine to be installed. Note that Duplicate File Finder is tested only on versions 1.3 and 1.3.1. Version 1.1.8 does not contain all necessary functionality for Duplicate File Finder and should therefore be upgraded from Sun Microsystems at http://java.sun.com free of charge. For more information about checking your system for a java installation, check the section below "Setting Up Java and JavaUNIX to Work Together".

Once Java is installed, it must be extended with the JavaUNIX API extension. JavaUNIX can be obtained at http://www.xenonsoft.demon.co.uk/products/java.html free of charge. Follow the instructions included with the JavaUNIX package to install it.

Installation of Duplicate File Finder requires you will need to copy the files dff and dff.jar to a location of your choice that is in you PATH environment. For example, the directory /usr/local/bin may be used. You may choose another location, just be sure to keep both files together in the same directory.

From there you can run Duplicate File Finder from the command line with "dff". If you want to make an Icon to run Duplicate File Finder, select your Window Managers tool for creating a new icon and set it to execute "dff".

Setting Up Java and JavaUNIX to Work Together
JavaUNIX requires an existing java installation. Most distributions already have one so usually it is only a matter of setting an environment variable to make JavaUNIX configure and compile.

It is also possible that some distributions have more than one version of java installed. For example SuSE 7.3 has java 1.1.8 and 1.3.1 installed in the /usr/lib directory with a link in that directory called "java" pointing to the jdk1.1.8 directory. In this case, simply delete the java link and replace it with a new one pointing to the most recent version of java installed. The link, in the case of SuSE 7.3, can be created as root with the command "ln -s /usr/lib/jdk1.3.1 /usr/lib/java". Other distributions may have the java installation in a different location, so the /usr/lib component of the command should be adjusted accordingly. When creating the link, be sure to leave off any trailing slashes, usually included when using the tab key to complete a file or directory name as these seem to cause problems when trying to compile the JavaUNIX extension.

To see which version of Java you have, enter the command "java -version" and you should see something like:

java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)

If you get something else, like a command not found error, you will have to examine your Java installation and environment paths to get them set so Java will run. If you have no Java installation, you will have to download a version of Java from Sun Microsystems. Sun Microsystems does require you to register with them, but they wont abuse your information like some other company will.

Once an appropriate version of java is installed and any necessary links created, you then need to be sure the correct environment variables are set in order to compile JavaUNIX.

To test if you have a JAVA_HOME environment variable set, enter the command "echo $JAVA_HOME". If you get something like "/usr/lib/java" or /usr/lib/jdk1.3.1", then your environment variable is already set and you should be able to start setting up the JavaUNIX api.

If on the other hand you get nothing but a blank line, there is no environment variable set for JAVA_HOME. To set one directly on the command line, assuming you have followed the steps above, you would enter the command "export JAVA_HOME=/usr/lib/java". As before, you should substitute the /usr/lib component of the command to suit you own setup.

You can also make this environment variable available for every time you start a shell by editing the login script that is executed each time you log in. Usually this is the ".bashrc" in you home directory. At the end of this file on its own line, add a line that is exactly the same as it would be for setting the variable on the command line. Save the file and exit. Next time you start a new shell, the JAVA_HOME environment variable should already be set.

Building JavaUNIX
When building JavaUNIX, you will need to have a Java SDK, for example j2sdk-1_4_2_04. The SDK includes the necessary tools for building JavaUNIX. The JRE does not have these tools and so a build of JavaUNIX with just the JRE won't work. If you need to get a Java SDK, you can download one from Sun Microsystems free of charge at http://java.sun.com.

JavaUNIX requires that the environment variable $JAVA_HOME is set to be the directory where your Java installtion is. For example, if you install Java in /opt/j2sdk1.4.2_04, then you will need to set your $JAVA_HOME environment variable to /opt/j2sdk1.4.2_04 with the command "export JAVA_HOME=/opt/j2sdk1.4.2_04".

To compile the JavaUNIX API, complete the usual "./configure", "make", and "make install" procedure in the directory where you extracted JavaUNIX. To check the compilation, run the command "make check" from the JavaUNIX directory. If you get a large listing of tests completed, your installation of JavaUNIX is complete. If you get exceptions like "Exception in thread "main" java.lang.UnsatisfiedLinkError: no javaunix in java.library.path", then follow the advice immediately below.

It is possible that recent versions of gcc and g++ will not successfully compile JavaUNIX, and there seems to be no one correct solution for every situation. Please try the following steps only if a build with the original JavaUNIX sources fail: You will need to edit the JavaUNIX file "com_xenon_unix_XenonGroup.cc". Line 114, which reads

jobjectArray group_members = env->NewObjectArray( N, string_class, 0 );

needs to be changed to one of three possibilities known at the time of writing this manual:

jobjectArray group_members = (jobjectArray *) env->NewObjectArray( N, string_class, 0 );
OR
jobjectArray group_members = (_jobjectArray *) env->NewObjectArray( N, string_class, 0 );
OR
jobjectArray group_members = (__jobjectArray *) env->NewObjectArray( N, string_class, 0 );


The modified line should remain as one line in the file and not be separated. Once this change is made, JavaUNIX should compile. If you continue to have problems, please send a copy of the output of the build attempt from the original, unmodified file to me through the Feedback form on the Duplicate File Finder homepage and I will attempt to help you further.

Building JavaUNIX requires the build directory of javaUNIX to be in your $PATH environment variable. If you are getting errors like "make: make-jrt-stub: Command not found", the JavaUNIX build directory is not in your current $PATH environment setting. The easiset way to solve this is to put the current directory into your $PATH environment setting using the command "export PATH=$PATH:." and build within the JavaUNIX build directory.

If at any time you find you need to rebuild JavaUNIX, it is best to completely delete the JavaUNIX build directory and start again. A break in the build process because of the $PATH not being set or the file "com_xenon_unix_XenonGroup.cc" needing to be modified does however not require a complete rebuild of JavaUNIX.

After the build of JavaUNIX is complete, and you have done the "make install", there is likely to still be difficulties with JavaUNIX. If, when you run Duplicate File Finder, you get an error message indicating JavaUNIX was not found or there is a problem with the JavaUNIX installation, it means you currently still don't have a usable installation of JavaUNIX. This problem is, however, easy to fix. Move the "libjavaunix.so" file from $JAVA_HOME/jre/lib/ext/Linux/libjavaunix.so to the $JAVA_HOME/jre/lib/i386/ directory. It may also be necessary to move the javaunix.jar file from $JAVA_HOME/jre/lib/ext/Linux/ to $JAVA_HOME/jre/lib/ext/ directory. Although these steps are not recommended by Sun Microsystems, it does work around the problems associated with the installation of JavaUNIX.


Starting Duplicate File Finder
After successfully installing Java, JavaUNIX and Duplicate File Finder, you should be able to start it from the command line simply by entering "dff" and hitting Return (well, pressing will actually do). If you get a command not found error, you should check the location that you installed Duplicate File Finder, and that the location is in your PATH environment variable.

Duplicate File Finder can also be made to start from an Icon. IN KDE, you can create a new application and set the execute component to "java -jar /usr/local/bin/dff.jar". After saving the new icon, it should be possible to click on that icon and Duplicate File Finder will start up. Note that any messages about errors will however not be seen. This issue will be addressed in a future version.

Previous: Introduction    Contents    Next: The Main Window