Feature #989

Updated by Matthieu Decorde about 4 years ago

Currently, TXM must be installed in an environment where Java is already installed (typically as a JRE).

This has several drawbacks:
* users must install a compatible Java themselves and it can be difficult to do (find it on the web, choose the right architecture 32/64-bit, the right version, some vendors like Apple sometime change their policy with respect to Java, sometimes there are temporary security risks for some versions or libraries, etc.), adding difficulties globally to run TXM on a machine
* this adds another component to the already big list of independant installations needed to run TXM on a machine (Java, TreeTagger software, TreeTagger models, TXM setup) resulting in a long and error prone installation process and not very practical for users (the ideal scenario for a software installation process is to launch just one installer software and that the installation process is the most automatic)
* if different Java versions can run TXM in a given environment we have the risk that TXM behavior can be different between them (typically at the borderline of the Java language specification - preemptive threads, etc. - or different versions of hosted Java libraries), and this can be very difficult to support and maintain from the point of view of TXM
* last but not least, Java suffers from its reputation of slowness and security risk in browser applets. Putting Java less in the front would help users to concentrate more on the right components for performance issues (like CQP search engine for example which is not written in Java) and not be needlessly alarmed about security risks (TXM execution context is not in an applet).

Embedding a JRE in TXM will greatly simplify TXM users and developers life.

See also https://groupes.renater.fr/wiki/txm-info/public/passage_de_java_6_a_java_7

*Definition of Java*

Java is implemented by a JVM and its environment called a JRE.

Oracle produces a Java version (http://www.oracle.com/technetwork/java/javase/downloads/index.html) based on the OpenJDK project (http://openjdk.java.net).

Java is available in a JDK. A JDK contains a JRE as the 'jre' sub-directory : '
Note that the file structure of the JRE is identical to that of the JDK's jre directory.
(see http://docs.oracle.com/javase/7/docs/technotes/tools/windows/jdkfiles.html)

* No need to modify setup building Bash scripts: add the jre files in org.txm.setups/trunk/archs/TXM directories
* Find a JRE for all architectures (Linux 32bit, Linux 64bit, Windows 32bit, Windows 64bit and Mac OS X 64bit)
** OpenJDK 6: https://github.com/alexkasko/openjdk-unofficial-builds#openjdk-unofficial-installers-for-windows-linux-and-mac-os-x
*** no Mac OS X version available
** OpenJDK7 (IceTea http://icedtea.classpath.org/wiki/Main_Page)
*** jre installers https://github.com/alexkasko/openjdk-unofficial-builds#openjdk-unofficial-installers-for-windows-linux-and-mac-os-x
*** ++ free
*** ++ same jre than the dev jre
*** ++ works with Mac OS X
*** - not much used with Windows and Mac OS X
** Oracle Java 6 : http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase6-419409.html#jdk-6u45-oth-JPR
*** no Oracle Mac OS X version available. We must use another one and ensure that it works for Mac OS X 10.6 to 10.9 :
**** OpenJDK seems available https://wiki.openjdk.java.net/display/BSDPort/Main
**** An apple Jvm seems also available : http://support.apple.com/kb/DL1572
**** Also see: http://www.macupdate.com/app/mac/33087/apple-java-for-mac-os-x-10.6, it may be the JVM version used for the tests about the bug #1255 (SWT_AWT bridge bug in Java 1.7 and 1.8). The complete version name used for these tests is 1.6.0_65-b14-462
** Oracle Java 7 http://www.oracle.com/technetwork/java/javase/downloads
*** it represents +40Mo for the setup and +160Mo for the installation files (65Mo for rt.jar and 60Mo for architecture dependent libs)
*** + most used jre
*** -- does not work with Mac OS X. Eclipse raise an error : "The JVM shared library "/Applications/TXM/TXM/jre/Contents/Home/jre/bin/../lib/server/libjvm.dylib" does not contains the JNI_CreateJavaVM symbol"
* The Mac OS X launcher fails to find the OpenJDK6 jre files, so we decided to not use it and call directly the JAR launcher file
* The Windows NSIS calls DetectJVM.exe which run a Jar file that detect if a JVM is installed. For now, this must be removed. Thus there is no need to detect if any JVM is installed.
* The Linux debian packages have 2 openjdk dependencies that must be removed (from the control file)

* First choice was the OpenJDK 7
** but there is a bug in some 1.7 versions with the SWT_AWT bridge on Mac OS X/Cocoa
* So we decided to downgrade to OpenJDK 6
** There is no OpenJDK 6 available for Mac OS X

See also "inclusion d'une JRE dans le logiciel": https://groupes.renater.fr/wiki/txm-info/documentation_java

h3. Validation Test with the OpenJDK 7

# Open TXM about dialog
# Open "Install details"
# select "Configurations" tab
# in the ordered list of properties you must find :
java.runtime.name=OpenJDK Runtime Environment
java.specification.name=Java Platform API Specification
java.specification.vendor=Oracle Corporation
java.vendor=Oracle Corporation
java.vm.info=mixed mode
java.vm.name=OpenJDK 64-Bit Server VM
java.vm.specification.name=Java Virtual Machine Specification
java.vm.specification.vendor=Oracle Corporation
java.vm.vendor=Oracle Corporation

To ensure this is not the current system jvm, in a terminal call :
java -version

h4. Ubuntu

Ubuntu 14.04 64bit: *OK* (MD)
Ubuntu 13.04 64bit (VM): *OK* (SJ)
Ubuntu 12.04 32bit: *OK* (MD)
Ubuntu 14.04 32bit: *OK* (MD)

h4. Windows

Windows 7 32bit: *OK* (MD)
Windows 7 64bit: *OK* (MD, SJ)
Windows XP (VM): *OK* (MD)
Windows XP: *OK* (SJ)

h4. Mac OS X

Mac OS X 10.6: Java 7 (Oracle) is *not supported* for Mac OS X < 10.7 ; NOR with openjdk unofficial
Mac OS X 10.7+: *OK* with openjdk unofficial
Mac OS X 10.6: with openjdk: starts but then crashes
Mac OS X 10.9.4 (VM): *OK* (SJ)