This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I have installed jdk 1.6 and jre 6. I had jdk 1.4 installed previously. When I run javac -version in cmd prompt , I get jdk version as 1.6.
But when i run java -version on cmd , i get jre version as 1.4. How can make it to read jre 6??
Note:- I am new to environment variables, so please explain in detail.
So, when you type "java" on the command line, the OS says "hmm...do I know what this is? no. Lemme try and figure it out.".
It check the first directory in the PATH, looking (in this case) for something called "java.exe". If it doesn't find it in the "C:\WINDOWS\system32", it next looks in the "C:\WINDOWS" directory. It keeps going until it either a) finds the java.exe in a directory, or b) runs out of directories to try.
Your PATH probably has several 'java' type entries. When you do "javac", it looks for the "javac.exe" in that list. For whatever reason, you have a java.exe in a path entry where you don't have a javac.exe (or vice versa).
You can probably shuffle the order of the entries to get the one you need, or better, take out the entires you don't need any more.
CAUTION: i'd make a backup of what your PATH is before editing it, just in case you screw something up.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors