So, imagine I’m doing a fresh installation, downloaded the latest version of Oracle JDK 1.6 and would like to add it as an alternative. That means that the alternative with the highest number will be executed by default, unless we manually set which is the default. The highest the number, the higher the priority. ** ** is the full path to the command of the alternative.If we set as ‘/usr/bin/java’, this means that when the ‘/usr/bin/ java‘ command is executed in our system, the default alternative for ‘ java‘ will be run. is the full path to the command that will be executed.If we set * * as *‘java’*, then when later we do: ‘*alternatives –config java*‘, the alternatives for ‘*java*‘ will be listed. ** ** is the name under which the alternative will be grouped.What the hell means each parameter? This is pretty obscure if you don’t really understand what’s the purpose of the ‘*alternatives*‘ program. Says that: *‘alternatives –install *‘, adds a new alternative. So, how to add a new alternative? I run the help first: $ alternatives -help It seems I got several If you just installed Fedora and run the command above, probably you’ll see nothing, as you haven’t added an alternative yet. Supposing we got several JDKs from different vendors installed, which will be the one executed in our system when the ‘ java‘ program runs?įirstly, I’ll check what are the Java alternatives configured in my system: $ alternatives -config java All these JDKs come with a ‘ java‘ executable. There are several JDK implementations: OpenJDK, GNU, JDK from Oracle, etc. ![]() ![]() This is very clear to see in the case of Java. When there are several programs that response to the same command in a system, the ‘ alternatives‘ command let us set which will be the real program that will be executed when that command is called. ![]() I will try in this post to explain how the ‘ alternatives‘ program works, specifically for configuring Java, and how I think its interface could be improved. I use the command-line all the time, but I just think the interface of this command is counterintuitive. I’m going to be honest, I hate ‘ alternatives‘ (with a passion). If you’re a Java developer and are using a Linux system, probably you’ve had to deal with the alternatives program.
0 Comments
Leave a Reply. |