Java - A bad idea ?

After earlier posts I've made regarding serial port locking and no satisfactory replies I've done a bit of trial and error attempts at figuring out what is going on. Apparently many other people have the same problem as I do and there seems to be no good 'answer/solution'. To reiterate, the problem 'seems' to be in the way JAVA's locking mechanism works. This goes for Windows, Mac and Linux. Once a serial port connection is established and a 'sketch' is uploaded the serial port is locked so no 'other application' can use it. That sounds like a good idea but it means you 'may' not be able to user the serial console to observe any data being transmitted to the port by your application because the console needs to establish a connection but it can NOT as it (the serial port) is already locked..... STUPID !!! There needs to be a better locking mechanism so you don't get locked out of the thing you just uploaded. Now I've spent days wasting my time trying to 'fix' this problem which would be far more productive if I could just concentrate on debugging my application. As no one is able to clearly state how to address this many people will, no doubt, waste their time too. After tinkering around I have manged to upload my sketch and get the console working, but only some of the times. I've proved to myself that my sketch works and that I can now proceed with making it better and adding functionality but I'll have to fight this locking crap every step of the way. Also, it seems that many other people have had this issue come up and they assume they've fried there board. Almost though that too myself but....I bought an Atmel AVRisp MKII and gave it a whirl. I was able to successfully re-install the bios to the chip ! So I knew there was nothing wrong with the board. And I tested individual pins to verify that all were working. Thus I persisted in overcoming this locking problem and still am trying to find a permanent solution. Perhaps using Java's internal locking method isn't such a good idea and some other (perhaps platform dependant ) locking method would be better. I don't know but I'm certain that this is a real issue with many Arduino users, present and future. I'll continue to move forward, frustrated or not, as I have things to accomplish. I think I'll even do that new Ubuntu install I've been putting off and see if I have better results than I've been having with my old tried and true openSUSE install. As I've seen numerous other people with this same lock-file problem in the Ubuntu forums I don't have any great expectations that this will help much but I'll probably give it a try just to see (and because I've been meaning to try Ubuntu anyway--what with all that stuff going on with Attachmate/Novell..

Sorry for the long rant. Just so frustrated with this lock-file garbage and not being able to achieve a satisfactory solution. Fighting my Arduino board and serial port is NOT what I wish to have to spend my time on. I'd rather report back to this group the success I've had in completing my live steam train semaphore signal project. And I'm getting closer to that goal every pain staking step of the way. As my club wants to convert the entire signal system over to a centralized system with a nice gui control panel I MUST overcome any serial port issues I'm having. I will not rest until this is complete so you'll definitely hear from me again... Other than this one issue I've been having fun learning how to use my Arduino and to refresh my knowledge of electronics. I'm sure I'll have many more projects in the future and I intend to use this line of products (Arduino) for those. Just a bit of a rough start, but I'll get past this.

Thanks for listening to my rant and I hope there is a solution for all of us frustrated lock-filled users... :roll_eyes:

P.S. Having fun anyway and thanks to all the folks who provide those on-line tutorials. I'm learning a lot.

I think any "clean" solution will lock the serial port while is in use.

You may use a serial port sniffer.

There are alternatives, if you're actually wanting to throw the baby out with the bathwater:

There's a bunch more at the playground.

That being said, I've not experienced the problems you're talking about; I interact with the serial port pretty regularly under 64-bit Linux (Fedora 14, using the system-provided rxtx and a build of Arduino 0022 that should show up in F15), both through the Arduino "serial monitor" and via minicom, without difficulty. Perhaps it's my build of rxtx?

If I understand you correctly, you think 2 applications should be able to access the serial port at the same time.

Imagine for one moment what will happen if the 2 applications starts sending data to the same port...

N.B. This is not a Java issue. It's the task of any OS to control which application has access to which hardware.

I think we have the same problem.

my post --> http://arduino.cc/forum/index.php/topic,51592.0.html

I use both the monitor and other terminal prog, with the monitor closing it also closes the connection and frees the port or use by other things.

Even if my Arduino is transmitting madly to the PC (using Windows) it has no affect on using the port.


Rob