We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
portInUseException (Read 2989 times)
portInUseException
Jul 15th, 2009, 11:44am
 
Hi all,
don't know how to solve it...I only managed to open a serial comm with an FTDI based hardware once. I always get a portinuseexception under Vista when I try to open a valid and available port...any ideas?


gnu.io.PortInUseException: Unknown Application
     at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354)
     at processing.serial.Serial.<init>(Serial.java:136)
     at processing.serial.Serial.<init>(Serial.java:102)
     at sketch_jul15a.setup(sketch_jul15a.java:72)
     at processing.core.PApplet.handleDraw(PApplet.java:1403)
     at processing.core.PApplet.run(PApplet.java:1328)
     at java.lang.Thread.run(Thread.java:619)
Exception in thread "Animation Thread" java.lang.RuntimeException: Error inside Serial.<init>()
     at processing.serial.Serial.errorMessage(Serial.java:588)
     at processing.serial.Serial.<init>(Serial.java:148)
     at processing.serial.Serial.<init>(Serial.java:102)
     at sketch_jul15a.setup(sketch_jul15a.java:72)
     at processing.core.PApplet.handleDraw(PApplet.java:1403)
     at processing.core.PApplet.run(PApplet.java:1328)
     at java.lang.Thread.run(Thread.java:619)
Re: portInUseException
Reply #1 - Aug 10th, 2009, 8:16pm
 
I'm getting the exact same error. Whether I call new Arduino(this, Arduino.list()[0], 9600); or Serial(this, Serial.list()[0], 9600); the error pops up. There are no other applications accessing the serial port, unless it is trying to open the port twice, through this animation routine?

Any ideas, anyone?
Re: portInUseException
Reply #2 - Aug 11th, 2009, 1:15am
 
What is the output of Code:
println(Arduino.list()); 


Also, where in your code is this called?

Edit: I should have also asked; "Where is the constructor called?"
Re: portInUseException
Reply #3 - Aug 14th, 2009, 3:24pm
 
I have the same problem on a Vista machine.  My println()s in setup() are being printed out twice, so it seems to me that setup() is being called twice and the Port In Use error is generated because I already have the port open.

Why would setup() be called more than once?

So put some prints in setup() and see if you have this situation.
Re: portInUseException
Reply #4 - Aug 14th, 2009, 3:47pm
 
This is why setup() is called twice:

size() has to be the first call in setup().

This board won't let me post a link to the page since I have too few posts, but consult the documentation for the size() function.
Re: portInUseException
Reply #5 - Mar 26th, 2010, 7:42am
 
I think the size() has nothing to do with it but a important thing to do regardless if you are communicating in serial.

Did it work for you?

I have the same problem but didn't fix it.
Page Index Toggle Pages: 1