How to use Java in the EMI releases

Setting dependencies on Java at build and runtime must follow a few rules to make sure it works in most conditions and with most OS distributions. The main guideline to be followed as much as practically possible is the Fedora Java packaging policy described at:

http://fedoraproject.org/wiki/Packaging/Java

Using java and java-devel as Requires and BuildRequires respectively ensures the best compliance with the policy, but may give different results on different OS distrbutions. Since EMI is currently supported on SL5, the following applies:

  1. Setting a dependency on 'java' will resolve to whatever the OS provides. In SL5 this is usually java-1.6.0-sun-compat (which in turn requires jdk) and java-1.6.0-openjdk plus a few other compatibilty packages
  2. Setting a dependency on 'java-devel' will resolve to whatever the OS provides. In SL5 this is usually java-1.6.0-sun-compat (which in turn requires jdk)
  3. Setting a dependency on 'jdk' will be resolved to the Sun jdk
  4. Setting a dependency on 'java-openjdk' will be resolved to java-1.6.0-openjdk
  5. Setting a dependency on 'java-devel-openjdk' will resolve to java-1.6.0-openjdk-devel

Therefore the described policy will result in EMI on SL5 being developed and installed with the Sun JDK. In case the use of the open jdk is REQUIRED for unsolvable technical reasons, specific dependencies can be set on java-openjdk and java-devel-openjdk

The following env vars are defined at the EMI project level:

JAVA_HOME=/usr/java/latest (the sun jdk)
JAVA_HOME_OPENJDK=/usr/lib/jvm/java-openjdk/ (the openjdk)

These variables can be used in ETICS build commands as for example:

export JAVA_HOME=${JAVA_HOME}
export JAVA_HOME=${JAVA_HOME_OPENJDK}

to make sure you use one or the other as you need (make sure that the env vars match your choice of dependencies). If you explicitly choose the open jdk, please investigate the consequences of depending at the same time on other java libraries that may have been compiled on SL5 with the Sun JDK.

The recommended configuration setup is:

Runtime dep: java
Buildtime dep: java-devel
export JAVA_HOME=${JAVA_HOME}
export PATH=$JAVA_HOME/bin:$PATH (if necessary to locate executables)

The export declarations have to be put in the build commands, in front of other statements using java. Please note that each command is executed with a separate shell call, therefore the export statements have to be used in every command where java is needed. They are also necessary to execute the build of the RPMS in mock, since the environment is not automatically defined in the spec file unless you do it

-- AlbertoDiMeglio - 06-Apr-2011

Edit | Attach | Watch | Print version | History: r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r1 - 2011-04-06 - AlbertoDiMeglio
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    EMI All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback