I've had this happen with IDE 1.05: I've been working on a program for many hours, perhaps performed 30 compiles using Com port 2, and everything is fine. Then I recompile again, which it does fine, but on the upload I get a message that says the port is already in use. Sometimes, if I save the current sketch, and try to recompile, it compiles and uploads without problem. Other times, that does not work and I have to exit the IDE altogether and reload the IDE, reload the sketch, and recompile/upload and things work fine again. Given enough recompiles, however, it will do the same thing again.
I'm using Windows 7 with 16Gb of memory. Has anyone else had this problem, and if so, did you find a work around?
I copied the complete error message, which is:
Binary sketch size: 11,416 bytes (of a 30,720 byte maximum)
processing.app.SerialException: Serial port 'COM2' already in use. Try quiting any programs that may be using it.
I haven't seen that problem. If it keeps happening, it would be possible to identify which process has the COM port open. As a first step, I suggest you check whether you have any applications installed which scan for serial devices. Cellphone manager applications often do this sort of thing.
Thanks Peter: I had it happen again several hours ago and I did load the Task Manager and, sure enough, there was a process tying up COM port 2. I right-clicked on the application and it identified the process as belonging to Chrome, which is the browser I use. Chrome has multiple processes running, but most of the time, none is identified as using COM port 2. I clicked on the End Process option, Chrome shut down, and the IDE was happy again. I can't identify what the process controls, nor do I remember doing anything but the usual within Chrome. Oh well, at least I know how to make it go away.
In that case I'd look for plug-ins and extensions installed in Chrome to see what on earth is causing it to access your serial ports. There's no obvious reason for a browser to need to do that.