You may need to export your PATH variable. Secondly, go to J2sdk1.4.2/bin dirrectory and run as ./java -versionIt should run properly. Important thing is to put bin directory in PATH while executing your java command.

Your first problem has to do with your PATH variable. In Unix (Linux, Mac OS, etc.), the OS locates commands by consulting the PATH variable.This is a colon-separated list of directories that you want the systemto look into for executables. Make sure it has the bin directorythat contains javac.

If you want the system to look in the current directory for an executable,you can add a . to your PATH environmentvariable (e.g: .:/bin:/usr/bin:$JRE_HOME/bin:

You can get more information on the behaviour of the PATH variable and how to set it (and other) environment variable by consulting the manual page for the shell youare using.