This is only due to javahome path missing.
Use the command line below:--
For Windows OS- Open your command prompt
netbeans-6.5.1-windows.exe --javahome "C:\\Program Files\Java\jdk1.5.0"
For Linux OS- Open your Terminal
netbeans-6.5.1-windows.sh --javahome /usr/jdk/jdk1.6.0_04
The problem solved.