switching between two installed Java versions (9.3)
What is up with the insane tangle of symlinks that makes up jpackage??! I remember how easy it used to be just to change the link /usr/lib/java and everything would be good. I don't find any documentation on how to do this anymore. What is the "canonical" way to switch back and forth between 1.4 and 1.5 in SUSE 9.3? surely not by editing all the symlinks in /etc/alternatives, or by uninstalling and reinstalling one or the other every time you want to switch? -- ====================================================== Glenn Holmer (Linux registered user #16682) ====================================================== "Greater coherence cannot be achieved. Not even the Netherlanders have managed this." -Anton Webern ======================================================
Glenn Holmer wrote:
What is up with the insane tangle of symlinks that makes up jpackage??! I remember how easy it used to be just to change the link /usr/lib/java and everything would be good. I don't find any documentation on how to do this anymore.
What is the "canonical" way to switch back and forth between 1.4 and 1.5 in SUSE 9.3? surely not by editing all the symlinks in /etc/alternatives, or by uninstalling and reinstalling one or the other every time you want to switch?
You should use the "update-alternatives" command if you want to switch to a different default java implementation, "man update-alternatives" will help a bit, but here is my understanding of how to use it on a properly configured system : Update-alternatives manages files in groups - you can work out the group names by listing /var/lib/rpm/alternatives, on my system (SuSE 9.3) this is: antlr eclipse_bin java javac java_sdk_1.4.2 java_sdk_1.5.0 java_sdk_sun jaxp_parser_impl jce_1.4.2_sun_local_policy jce_1.5.0_sun_local_policy jmxri jre_1.4.2 jre_1.5.0 jre_sun servlet "update-alternatives --display <name>" will show the state of any of these, and the list of slave packages in each group. On my system to completely switch I update "java", "javac", "java_sdk_sun" and "jre_sun" (I'm not totally clear on what the last two do by the way :) To change the currently selected alternative, run (as root) "update-alternatives --config java" - you will get an interactive prompt where you can change the java version, which will change the symlinks in /etc/alternatives. Then do the same for "javac", "java_sdk_sun" and "jre_sun". "update-alternatives --auto <name>" will revert to auto-mode. I'm not sure how you change the priorities of "auto" mode, I suspect there is some way (apart from re-running "update-alternatives --install", or manually editing config files) but I haven't found it yet. I'm also not sure how to do this for a single shell, like the old system allowed. You can get there manually by setting environment variables (as defined in /etc/java/java.conf) and manually running the right "java" or "javac" binary, but I haven't really tested this in detail. - Korny -- Kornelis Sietsma e-mail: korny at my surname dot com
On Thursday 02 June 2005 21:37, Kornelis Sietsma wrote:
Glenn Holmer wrote:
What is up with the insane tangle of symlinks that makes up jpackage??! I remember how easy it used to be just to change the link /usr/lib/java and everything would be good. I don't find any documentation on how to do this anymore.
On my system to completely switch I update "java", "javac", "java_sdk_sun" and "jre_sun" (I'm not totally clear on what the last two do by the way :)
The problem is that there are so many symlinks in /etc/alternatives (jar, appletviewer, rmic, keytool, javaws, javadoc, etc. etc.). I wish there were a way to switch them all over in one go. -- ====================================================== Glenn Holmer (Linux registered user #16682) ====================================================== "Greater coherence cannot be achieved. Not even the Netherlanders have managed this." -Anton Webern ======================================================
Glenn Holmer wrote:
On Thursday 02 June 2005 21:37, Kornelis Sietsma wrote:
Glenn Holmer wrote:
What is up with the insane tangle of symlinks that makes up jpackage??! I remember how easy it used to be just to change the link /usr/lib/java and everything would be good. I don't find any documentation on how to do this anymore.
On my system to completely switch I update "java", "javac", "java_sdk_sun" and "jre_sun" (I'm not totally clear on what the last two do by the way :)
The problem is that there are so many symlinks in /etc/alternatives (jar, appletviewer, rmic, keytool, javaws, javadoc, etc. etc.). I wish there were a way to switch them all over in one go.
Changing the "java" and "javac" groups will change all of their slave packages as well, updating all those symlinks with two commands. The "java_sdk_sun" and "jre_sun" groups change one or two symlinks each, from memory, I'm not sure what they are for but included them for completeness. but running "update-alternatives" four times will change *all* the symlinks, and do so in a way that should be compatible with all jpackage.org java packages. The jpackage.org stuff is pretty nice, imho, though it has the problem that a huge number of other tools assume that Java software is packaged as it comes from Sun or whoever distributes it - for example, I don't use the jpackage/SuSE version of Tomcat, even though it gives nice system integration, as it breaks some tools that assume Tomcat files are all in exactly the right places (specifically, appFuse :) even with the mass of symlinked directories provided. But generally, it's a good way to integrate java tools and applications into Linux, and is rapidly becoming a "standard", albeit one that Sun seem uninterested in supporting... - Korny -- Kornelis Sietsma e-mail: korny at my surname dot com
On Saturday 04 June 2005 02:23, Kornelis Sietsma wrote:
Changing the "java" and "javac" groups will change all of their slave packages as well, updating all those symlinks with two commands. The "java_sdk_sun" and "jre_sun" groups change one or two symlinks each, from memory, I'm not sure what they are for but included them for completeness. but running "update-alternatives" four times will change *all* the symlinks, and do so in a way that should be compatible with all jpackage.org java packages.
Thanks, I missed from your first response that one of these commands could update a whole group of symlinks. I feel much better now :) And you can do in in one go if you make the assumption that you know what the response should be: #!/bin/sh # Switch to Java 1.5 by changing symlinks in /etc/alternatives echo 2 | update-alternatives --config java echo 2 | update-alternatives --config javac echo 2 | update-alternatives --config java_sdk_sun echo 2 | update-alternatives --config jre_sun I saw Sang Shin give his talk "Roar of the Tiger" yesterday, and after that, I am totally committed to switching all our systems at work to 1.5 (assuming we don't uncover any compatibility issues). So this solves a big hurdle for testing, as all our web servers (as well as a number of standalone machines in the factory and warehouse) run SUSE Pro.
The jpackage.org stuff is pretty nice, imho, though it has the problem that a huge number of other tools assume that Java software is packaged as it comes from Sun or whoever distributes it
I think it's nuts; anything that relies on such a Medusa of symlinks to symlinks to symlinks is an offense against nature :( OTOH, now that I understand the use of update-alternatives, my headache is going away.
for example, I don't use the jpackage/SuSE version of Tomcat, even though it gives nice system integration, as it breaks some tools that assume Tomcat files are all in exactly the right places (specifically, appFuse :) even with the mass of symlinked directories provided.
I had to provide quite an elaborate HOWTO at work to set up Tomcat with Apache using mod_jk, but it works beautifully. But I'm wondering what to do about Tomcat 5.5... does 5.0 run well under Tiger?
But generally, it's a good way to integrate java tools and applications into Linux, and is rapidly becoming a "standard", albeit one that Sun seem uninterested in supporting...
I'm not convinced yet :| Note that /usr/share/doc/packages/jpackage-utils/README.SUSE says you can't install the packages from jpackage.org anyway, at least in 9.2. Haven't checked yet to see if this works in 9.3. -- ====================================================== Glenn Holmer (Linux registered user #16682) ====================================================== "Greater coherence cannot be achieved. Not even the Netherlanders have managed this." -Anton Webern ======================================================
Kornelis Sietsma wrote:
Glenn Holmer wrote:
On Thursday 02 June 2005 21:37, Kornelis Sietsma wrote:
Glenn Holmer wrote:
What is up with the insane tangle of symlinks that makes up jpackage??! I remember how easy it used to be just to change the link /usr/lib/java and everything would be good. I don't find any documentation on how to do this anymore.
On my system to completely switch I update "java", "javac", "java_sdk_sun" and "jre_sun" (I'm not totally clear on what the last two do by the way :)
The problem is that there are so many symlinks in /etc/alternatives (jar, appletviewer, rmic, keytool, javaws, javadoc, etc. etc.). I wish there were a way to switch them all over in one go.
Changing the "java" and "javac" groups will change all of their slave packages as well, updating all those symlinks with two commands. The "java_sdk_sun" and "jre_sun" groups change one or two symlinks each, from memory, I'm not sure what they are for but included them for completeness. but running "update-alternatives" four times will change *all* the symlinks, and do so in a way that should be compatible with all jpackage.org java packages.
The jpackage.org stuff is pretty nice, imho, though it has the problem that a huge number of other tools assume that Java software is packaged as it comes from Sun or whoever distributes it - for example, I don't use the jpackage/SuSE version of Tomcat, even though it gives nice system integration, as it breaks some tools that assume Tomcat files are all in exactly the right places (specifically, appFuse :) even with the mass of symlinked directories provided. But generally, it's a good way to integrate java tools and applications into Linux, and is rapidly becoming a "standard", albeit one that Sun seem uninterested in supporting...
I've not had to do java yet, but when I was doing software development for a large research facility and had to use several different compilers and graphics packages, I installed the resources into /opt/..., then used symlinks in /usr/bin, /usr/lib, /lib, /etc, and so on, and used a set of shell scripts to change the (sometimes) dozens of environment variables and commands to the environment I needed. If Korny's methods don't work out, you could give that a try.
- Korny
Glenn Holmer wrote:
What is up with the insane tangle of symlinks that makes up jpackage??! I remember how easy it used to be just to change the link /usr/lib/java and everything would be good. I don't find any documentation on how to do this anymore.
What is the "canonical" way to switch back and forth between 1.4 and 1.5 in SUSE 9.3? surely not by editing all the symlinks in /etc/alternatives, or by uninstalling and reinstalling one or the other every time you want to switch?
Perhaps the easist way would be to open a konsole and run $ export PATH=/usr/lib/jvm/java-1.4.2-sun/bin/:$PATH each time you specifically want to use java 1.4.2. You could even put this in a shell script. Alternatively, instead of $ java app use $ /usr/lib/jvm/java-1.4.2-sun/bin/java app and you'll get the 1.4.2 version. Compiling should be more straightforward if you use the -target flag. -- JDL
participants (4)
-
Glenn Holmer
-
John D Lamb
-
John Perry
-
Kornelis Sietsma