thermike:
I used to run it from a desktop shortcut. But during this debugging I ran it from .exe in \program files\arduino\ . It makes no difference. I have the same result.
Bummer.
Do you know if the IDE uses some environment variables stored somewhere in windows when it starts?
Doesn't matter. The compiler is very likely the culprit (not the IDE). And, yes, the GCC compiler does use environment variables. And, yes, that could be causing the problem.
Try this...
• Open a command shell
• Type set and press Enter
• All the environment variables should be output; it will look something like this...
...
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 6 Model 23 Stepping 6, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=1706
...
• Maybe you can spot something suspicious (and GCC / GNU related).
Note: If you decide to post the output be sure to redact any personal information.
Also when deleting / uninstalling older version is there a possibility for something older (maybe corrupted) to remain in the pc?
That's very unlikely. The entire Arduino software is kept under the one directory tree.
Also should I look for something in the registry?
As far as I know, the Arduino IDE does not use the Registry at all.
Where in the forum can we ask somebody from the team that wrote the IDE to tell us what the return code 3 means.
http://arduino.cc/en/Main/ContactUs
However, even someone from the Arduino team is probably not going to be able to help. GCC is very likely the culprit, and, as far as I know, the Arduino folks use it as it comes from the avr-gcc / GNU folks.
Try searching your computer for msvcrt.dll. There are probably several copies on your computer. There should be a copy in {ArduinoRootFolder}\java\bin.
Have you tried running the IDE as administrator?
Have you tried the latest version of WinAVR?