So Java runs in a similar fashion to other *NIX systems I have added aliases for java and javac so they work with the VM set in java config.As you want to run the command echoed by java-config --java as your alias instead of the actual command itself you have to put it in command-quotes inside single-quotes: alias java='`java-config --java`' alias javac='`java-config --javac`' This works with bash and should work with other shells which support aliases. You then use java and javac as you normally would: javac JavaApp.java java JaavaApp Reproducible: Always Steps to Reproduce: 1.alias java='`java-config --java`' 2.alias javac='`java-config --javac`' 3.alias Actual Results: ... alias java='`java-config --java`' alias javac='`java-config --javac`' ... Expected Results: As expected Needs java-config and a Java VM to be installed and set. Alias should overwrite any java or javac commands in your $PATH $ bash --version GNU bash, version 2.05b.0(1)-release (i586-pc-linux-gnu) Copyright (C) 2002 Free Software Foundation, Inc. Karl Trygve Kalleberg has asked for this bug to be assigned to him.
Actually at my system "java-config --java" and "which java" return the same. I see no reason for the users to create an alias for java if it works.
Hi I'm assuming this is because you've got the correct java directory in your PATH, which isn't there by default becasue it goes in /opt/. Thinking about it a better way of doing it without using aliases is to add the correct java dir to your PATH. This way all the java binaries, including appletviewer etc., will point to the correct ones. I've added this to my ~/.bash_profile: PATH=/dirs/in/path JAVAPATH=`java-config --jdk-home`/bin PATH=${PATH}:${JAVAPATH} export PATH Without a java dir in your path `which java` gives the error: which: no java in (/dirs/in/path) This ensures that you're always using the correct java, appletviewer, etc. as long as you remember to `. ~/.bash_profile` after you change the jdk with java-config.
The java binaries are placed inside their /opt directories, and the PATH variable is extended with that directory (check /etc/env.d/20java and /etc/env.d/30java-finalclasspath). Installing java automatically sets those stuff. If some java ebuild doesn't do that, then that's an error of the ebuild.