How to run SPMF without installing Java?

The SPMF data mining software is a popular open-source software for discovering patterns in data and for performing other data mining tasks. Typically, to run SPMFJava must have been installed on a computer. However, it is possible to run SPMF on a computer that does not have Java installed. For example, this can be useful to run SPMF on a Windows computer where the security policy does not allow to install Java. I will explain how to achieve this, and discuss alternative ways of running a Java program without requiring to install Java or by installing it automatically.

Method 1: Packaging the application in a .exe file with the Java Runtime Environment

This is one of of the most convenient approach. To do this, one may use a commercial software like Excelsior JET https://www.excelsiorjet.com/) . This software is not free but provides a 90 day full featured evaluation period.  Using this software, we can choose a jar file such as spmf.jar.  Then, Excelsior JET packages the Java Runtime Environment with that application in a single .exe file. Thus, a user can click on the .exe file to run the program just like any other .exe program.

Converting SPMF to exe

To try a 32 bit version of SPMF 2.30 that has been packaged in an .exe file using JET Excelsior, you can download this file:  spmf_jet.exe  (2018-04-02)
However, note that I have generated this file for testing purpose and will not update this file for each future release of SPMF.

While trying JET Excelsior, I made a few observations:

  • If we want to generate a .exe file that can be used on 32 bit computers, we should make sure to package a 32 bit version of the Java Runtime Environment in the .exe file (instead of the 64 bit JRE). This means that the 32 bit version of the Java Runtime Environment should have been installed on your computer.
  • Although the software does what it should do, it sometimes results in some slow down of the application. I assume that it must be because files are uncompressed from the .exe file.
  • Packaging the runtime environment increases the size of your application. For example, the SPMF.jar file is about 6 megabytes, while the resulting .exe file is about 15 megabytes.
  • Although a Java application is transformed into an .exe file, it stills uses the Java memory management model of using a Garbage Collector. Thus, the performance of the .exe should not be compared with a native application developed in language such as C/C++.

Method 2: Using a Java compiler such as GCJ

There is exists some Java compiler such as GNU GCJ (http://gcc.gnu.org/)  that can compile a Java program to a native .exe file. I have previously tried to compile SPMF using GCJ. However, it failed since GCJ  does not completely support SWING and AWT user interfaces, and some advanced features of Java. Thus, the graphical user interface of SPMF could not be compiled using GCJ and some other classes. In general, GCJ can be applied for compiling simple command-line Java programs.

Method 3: Using JSmooth to automatically detect the Java Runtime Environment or installl it on the host computer

An alternative called JSmooth (http://jsmooth.sourceforge.net/ ) allows to create an .exe file from a Java program. Different from Excelsior Jet, JSmooth does not package the Java Runtime Environment in a .exe file. The .exe file is instead designed to search for a Java Runtime Environment on the computer where it is run or to download it for the user. I did not try it but it seems like an interesting solution. However, if it is run on a public computer, this approach may fail as it requires to install Java on the computer, and  local security policies may prevent the installation of Java.

Method 4: Installing a portable version of the Java Runtime Environment on a USB stick to run a .jar file

There exists some portable software called jPortable and jPortable Launcher (download here: https://portableapps.com/apps ) to easily install a Java Runtime Environment on a USB stick. Then the jPortable Launcher software can be used to launch a .jar file containing a Java application.

Although this option seems very convenient as it is free and does not require to install Java on a host computer, the installation of jPortable failed on my computer as it was unable to download the Java Runtime Environment. It appears that the reason is that the download URL is hard-coded in the application and that jPortable has not been updated for several months.

Conclusion

There might be other ways of running Java software on a host computer without installing Java. I have only described the ones that I have tested or considered. If you have other suggestions, please share your ideas in the comments section, below.


Philippe Fournier-Viger is a professor of Computer Science and also the founder of the open-source data mining software SPMF, offering more than 145 data mining algorithms.

This entry was posted in Data Mining, Data science, open-source, Pattern Mining, Research, spmf and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *