Tuesday, October 4, 2011

Various Java VM on my Debian / Ubuntu. What can I do?

The situation
Many of us prefer Sun JVM (Oracle now) for historical or non-historical reasons. Many of us also prefer Debian, Ubuntu and/or even Red Hat. But when we go and install LibreOffice (for example), via apt-get other powerful player arrives: openjdk. I don't want to discuss which JVM implementation is the most "appropriate" for us, you or them. There is a fact, many JVM can and should coexists pacifically.

But the question persists
- After installing various Java-dependant packages on my GNU/Linux OS preferred distribution, and I issue the javac command, which JVM compiler is invoked? 
- How can I set my preferred Java implementation per command basis?

The solution
The Debian alternatives system is devoted to solve the problem of choosing the default preferred implementation of various kinds of programs: text editors, mail agents, JVM, etc.

The options are settled via update-alternatives in a terminal and there is also a graphical version called galternatives.


The Example
This script sets various' Sun JVM (Oracle now) commands as the default alternatives for: java packaging, java VM, java compiler, javadoc, etc. It runs update-alternatives command several times, one per java command.

1 comment:

  1. Very helpful suggestions that help in the optimizing website.
    thank for sharing the link.
    goldenslot
    gclub
    gclub casino

    ReplyDelete