participate


Sun Java Wireless Toolkit - How to access 'javax.bluetooth' from javaSE side?
This question is answered.

<<   Back to Forum  |   Give us Feedback
This topic has 10 replies on 1 page.
cookdav
Posts:9
Registered: 15/03/09
How to access 'javax.bluetooth' from javaSE side?   
Mar 15, 2009 6:24 PM
 
 
It's clear that the designers of 'javax.bluetooth' package decided to put
it into 'javaME', rather than 'javaSE'. But, that is causing me grief and
confusion, because I'm trying to write a simple 'bluetooth hello-world'
application to utilize a bluetooth-adapter (USB-dongle) plugged into
my laptop, but Netbeans (v6.5) will ONLY let me access the
'javax.bluetooth' package from a 'javaME' app, but NOT from a 'javaSE'
app.

In otherwords, if I create a 'newproject' by choosing 'JavaME' app,
(where the only sub-choice that makes sense is then an 'MiDP' app), it generates all
the (unwanted by me) stuff for an app that would be deployed INSIDE
a 'mobile device'. But, I don't plan to run the code from the mobile-device-side
of the bluetooth-link, but from the PC-side of the bluetooth-link.
An 'MiDP' app resolves the import line:

import javax.bluetooth.*;

when I build that kind of simple MiDP-app.

But, if I instead create a 'JavaSE' app (which is what I WANT), when
I put that same import line into the code, Netbeans complains that there
is no such package.

So, what should I do in Netbeans, so that I can create a standard
PC-platform-based app to use that package?

TIA...

Edited by: cookdav on Mar 15, 2009 9:23 PM
 
Atul.Moglewar
Posts:166
Registered: 2/14/08
Re: How to access 'javax.bluetooth' from javaSE side?   
Mar 15, 2009 9:24 PM (reply 1 of 10)  (In reply to original post )
 
 
Look at http://www.bluecove.org/
Bluecove is jsr82 implementation for J2SE. It supports WIDCOMM, BlueSoleil and Microsoft Bluetooth stack.
 
cookdav
Posts:9
Registered: 15/03/09
Re: How to access 'javax.bluetooth' from javaSE side?   
Mar 16, 2009 9:14 AM (reply 2 of 10)  (In reply to #1 )
 
 
Hmm...yes, I've run across this apparent fact that there are MULTIPLE
implementations of JSR82 (rather than just one). Not sure I like that
idea, since one would then feel compelled to evaluate more than one,
before deciding which one is more complete/less buggy, or whatever!?!

So, Sun did NOT do their own implementation of JSR82?

Has there been a somewhat definitive article that evaluated the major
implementations of JSR82, and compared them?

And, back to specific question of the thread: Are you recommending
the 'BlueCove' one specifically because you know that it works ok
from the 'JavaSE' side?
 
Atul.Moglewar
Posts:166
Registered: 2/14/08
Re: How to access 'javax.bluetooth' from javaSE side?   
Mar 16, 2009 10:40 AM (reply 3 of 10)  (In reply to #2 )
 
 
And, back to specific question of the thread: Are you recommending
the 'BlueCove' one specifically because you know that it works ok
from the 'JavaSE' side?

I used bluecove as a part of my research project. it worked pretty well.
 
cookdav
Posts:9
Registered: 15/03/09
Re: How to access 'javax.bluetooth' from javaSE side?   
Mar 18, 2009 8:12 AM (reply 4 of 10)  (In reply to #3 )
 
 
[I took a quick look at 'Bluesoleil/Linux', since Linux is my platform of choice. But,
even that edition is a 'paid-for' product. NOT what I'm looking for.]

Luckily, my (first) textbook on Java-Bluetooth arrived today. It is:
'Bluetooth Application Programming with the Java APIs (Essentials Edition, copyright 2008.)'.

It addresses the problem (i.e. lack of Java-Bluetooth support for javaSE) in a CONCEPTUAL
way, mentioning 'JSR-197' as the (potential) solution.

But, that just begs the question:

Are there any IMPLEMENTATIONS yet of JSR-197, that solve the problem? Or, must we
wait around for a while (more years) for one of those?

[Or, am I still missing something?]

Edited by: cookdav on Mar 18, 2009 11:09 AM
 
clivejefferies
Posts:5
Registered: 4/22/04
Re: How to access 'javax.bluetooth' from javaSE side?   
Mar 19, 2009 3:32 AM (reply 5 of 10)  (In reply to #4 )
 
 
Bluecove worked for me, there is a good example of how to use it on the NokiaForum examples.
 
cookdav
Posts:9
Registered: 15/03/09
Re: How to access 'javax.bluetooth' from javaSE side?   
Mar 19, 2009 6:29 AM (reply 6 of 10)  (In reply to #5 )
 
 
Clive -

Hmm...I searched all over, after joining, in the Nokia Forum examples.
I see a bunch written in C/C++, but I didn't find any Java examples.
Can you give me an explicit pointer/URL to the example you're
talking about?

[You're referring to JavaSE (not JavaME), right? I am NOT
trying to write a program to load INTO a mobile device, but
rather I want to run it from a PC (WITHOUT using a javaME emulator).]

Edited by: cookdav on Mar 19, 2009 9:28 AM
 
cookdav
Posts:9
Registered: 15/03/09
Re: How to access 'javax.bluetooth' from javaSE side?   
Mar 22, 2009 10:12 AM (reply 7 of 10)  (In reply to #6 )
 
 
Yes! Sorry for not trusting that 'BlueCove' does indeed solve
the basic issue.

So, I'm getting somewhat closer, but not QUITE there yet.
I downloaded 'BlueCove', from SourceForge, in the form of:
bluecove-2.1.0.jar
and put that on my classpath. So, now a simple JavaSE program compiles.

But, when I RUN it, I get: an error:
BlueCove com.intel.bluetooth.BluetoothStackBlueZ not available

[This is on Linux, so my stack IS (should be) the default 'BlueZ' stack.]

I assume that there must be some ADDITIONAL jar that I'm supposed to get someplace.

So, where do I get what it says it missing? (Or, is something else going on?!?)

Edited by: cookdav on Mar 22, 2009 1:11 PM
 
aoik
Posts:7
Registered: 8/1/07
Re: How to access 'javax.bluetooth' from javaSE side?   
Apr 22, 2009 1:02 PM (reply 8 of 10)  (In reply to #7 )
 
 
From the BlueCove site

BlueCove library of the same mojor version
Package bluez-libs 3.7 or later installed on your system
We linked JNI library with libbluetooth.so (Not libbluetooth.so.3 or libbluetooth.so.2) to be able to use same build with Bluez Version 3 and Version 4
o You need package/rpm that creates a link libbluetooth.so to already installed libbluetooth.so.3 or libbluetooth.so.2
o libbluetooth-dev on Ubuntu
o bluez-libs-devel on Fedora
o bluez-devel on openSUSE
To change Discoverable mode of the device you should be root
* On 64-bit Linux platform 64-bit java should be used

I think what you are missing here is the package/rpm
 
cookdav
Posts:9
Registered: 15/03/09
Re: How to access 'javax.bluetooth' from javaSE side?   
Apr 22, 2009 3:20 PM (reply 9 of 10)  (In reply to #8 )
 
 
Thanks for the response.

But, no that does NOT seem to be the problem. (There already IS a sym-link, from libbluetooth.so to libbluetooth.so.2
(I have BlueZ 4.3)

Also, I'm quite sure that I would NOT get nearly as deeply into my code, if linkage into that lib was not working.

No, whatever the problem is, it is much more subtle than that, as earlier calls work and most all of my code works, except
for some small code path down in the bowels somewhere.

But, again, thanks for responding.
 
cookdav
Posts:9
Registered: 15/03/09
Re: How to access 'javax.bluetooth' from javaSE side?   
Apr 30, 2009 12:07 PM (reply 10 of 10)  (In reply to #9 )
 
 
I solved the FIRST symptom of the stack/library being missing, by adding the
required SECOND bluecove jar (that is needed ONLY on Linux).

And, I finally solved it completely, just by installing the package 'libbluetooth-dev'.

[That was definitely the tweak that was needed. Lesson learned.]

Edited by: cookdav on Apr 30, 2009 3:06 PM
 
This topic has 10 replies on 1 page.
Back to Forum
 
Read the Developer Forums Code of Conduct

Click to email this message Email this Topic

Edit this Topic
  
 
 
Forums Statistics
    Users Online : 28
  • Guests : 129

About Sun forums
  • Oracle Forums is a large collection of user generated discussions. It is here to help you ask questions, find answers, and participate in discussions.

    Check out our guide on Getting started with Oracle Forums for a full walkthrough of how to best leverage the benefits of this community.

Powered by Jive Forums