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?
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?
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.
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?
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).]
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?!?)
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
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.