Hi all,

First of all, I will excuse me for my bad english.

I've searched a long in all the subforum and I haven't find any solution or any post regarding my problem.
So here it is.

I'm developing a program that, in the end, will find the position of a specified mobile device, using the trilateration method.
But the problem i'm going to explain, is only the first step of it.
Searching on the Net I found some examples that explain how to do the discovery of any bluetooth device.

So, I wanted to test it on my own, and I'm using Netbeans IDE for this (I wanted to use Eclipse, but for me and for the work I have to do, i think it's better Netbeans).
I created new Midlet Suite Project and after I added to the project, the following code:


/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

import java.io.IOException;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.List;
import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.AlertType;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeExcepti on;
import javax.bluetooth.DiscoveryListener;
import javax.bluetooth.LocalDevice;
import javax.bluetooth.RemoteDevice;
import javax.bluetooth.DeviceClass;
import javax.bluetooth.ServiceRecord;
import javax.bluetooth.BluetoothStateException;
import javax.bluetooth.DiscoveryAgent;

public class DeviceDiscovery2 extends MIDlet implements CommandListener,
DiscoveryListener {
private Display display;
/**
* For displaying found devices.
*/
private List listDev;
private Command cmdExit;
private Command cmdDiscover;
private Command cmdStopDiscover;

private LocalDevice devLocal;
private DiscoveryAgent discoverAgent;


/**
* Constructor. Constructs the object and initializes displayables.
*/
public DeviceDiscovery2() {
InitializeComponents();
}
/**
* Initializes a ListBox object and adds softkeys.
*/
protected void InitializeComponents() {
display = Display.getDisplay( this );
//initializing device list
listDev = new List( "Device list", List.IMPLICIT );

cmdExit = new Command( "Exit", Command.EXIT, 1 );
cmdDiscover = new Command( "Start", Command.SCREEN, 1);
cmdStopDiscover = new Command( "Stop", Command.SCREEN, 1);

listDev.addCommand( cmdExit );
listDev.addCommand( cmdDiscover );
listDev.setCommandListener( this );
}

/**
* From MIDlet.
* Called when MIDlet is started.
* @throws javax.microedition.midlet.MIDletStateChangeExcepti on
*/
public void startApp() throws MIDletStateChangeException {
display.setCurrent( listDev );
}
/**
* From MIDlet.
* Called to signal the MIDlet to enter the Paused state.
*/
public void pauseApp() {
//No implementation required
}
/**
* From MIDlet.
* Called to signal the MIDlet to terminate.
* @param unconditional whether the MIDlet has to be unconditionally
* terminated
* @throws javax.microedition.midlet.MIDletStateChangeExcepti on
*/
public void destroyApp(boolean unconditional)
throws MIDletStateChangeException {
exitMIDlet();
}
/**
* From CommandListener.
* Called by the system to indicate that a command has been invoked on a
* particular displayable.
* @param command the command that was invoked
* @param displayable the displayable where the command was invoked
*/
public void commandAction( Command command, Displayable displayable ) {

if( command == cmdExit ) {
exitMIDlet();
}
if( command == cmdDiscover ) {
int err = 0;
err = initLocalDevice();
if( err != 0 ){
return;
}
err = startDeviceSearch();
if( err != 0) {
return;
}
//we do not need a start soft key when in descovery mode
listDev.removeCommand( cmdDiscover );
//now we add stop soft key
listDev.addCommand( cmdStopDiscover );
}
if( command == cmdStopDiscover ) {
stopDiscover();
//we remove stop softkey
listDev.removeCommand( cmdStopDiscover );
//adding start soft key
listDev.addCommand( cmdDiscover );
}
}
/**
* Method calls stopDiscover method and notifyDestroyed after that.
*/
protected void exitMIDlet() {
stopDiscover();
notifyDestroyed();
}
/**
* Gets a reference to LocalDevice and saves it to devLocal variable.
* @return '0' if local device reference getting succeded. '-1' on exception.
*/
protected int initLocalDevice() {
try {
devLocal = LocalDevice.getLocalDevice();
} catch (BluetoothStateException e) {
showErrAlert( "Error getting local device!" );
return -1;
}
return 0;
}
/**
* Clears device listbox, retreves DiscoveryAgent instance and saves it to
* discoveryAgent variable. Starts device inquiry mode with access code
* General/Unlimited Inquiry Access Code (GIAC).
* @return '0' function execution was successfull.
* '-1' if startInquiry threw an exception.
* @see JSR82 for more info.
*/
protected int startDeviceSearch() {
discoverAgent = devLocal.getDiscoveryAgent();
try {
listDev.deleteAll();
discoverAgent.startInquiry( DiscoveryAgent.GIAC,
this );
} catch( BluetoothStateException e ) {
showErrAlert( "Error starting device enquiry!" );
return -1;
}
return 0;
}

/**
* From DiscoveryListener.
* Called when new bluetooth device discovered.
* @param remoteDev reference to RemoteDevice object instance of
* discovered device
* @param devClass the service classes, major device class,
* and minor device class of the remote device
*/
public void deviceDiscovered(RemoteDevice remoteDev, DeviceClass devClass) {
try {
//add device "Friendly name" to a listbox
listDev.append( "Device: " + remoteDev.getFriendlyName( false ),
null);
} catch ( IOException e ) {
//TODO: Handle error
}
}

/**
* From DiscoveryListener.
* Called when service(s) are found during a service search.
* @param transID the transaction ID of the service search that is
* posting the result
* @param servRecord a list of services found during the search request
*/
public void servicesDiscovered(int transID, ServiceRecord[] servRecord) {
//No implementation required
}

/**
* From DiscoveryListener.
* Called when a service search is completed or was terminated
* because of an error
* @param transID the transaction ID identifying the request which
* initiated the service search
* @param respCode the response code that indicates the status
* of the transaction
*/
public void serviceSearchCompleted(int transID, int respCode) {
//No implementation required
}

/**
* From DiscoveryListener.
* Called when an inquiry is completed.
* @param discType the type of request that was completed
*/
public void inquiryCompleted(int discType) {
// No implementation required
}
/**
* Show error alert with a string specified in strError.
* @param strError Error message show.
*/
protected void showErrAlert( String strError ) {
Alert alertErr = new Alert("Error", strError, null, AlertType.ERROR );
display.setCurrent( alertErr );
}

/**
* Stops device discovery mode.
*/
protected void stopDiscover() {
//we turning of the device discovery mode
discoverAgent.cancelInquiry( this );
}
}



After this I ran the application as Midlet an it gave me the following warning


Installing suite from: http://127.0.0.1:50649/testnb1_bluetooth.jad
[WARN] [rms ] javacall_file_open: _wopen failed for: C:\Users\Stefano\javame-sdk\3.0\work\0\appdb\_delete_notify.dat


and so the emulator starts its execution but it never gave me any information.
After this I tried to install the Jar file on my cell phone, and, surprise, it works perfectly!

I thought there could be some hardware problem with my laptop (I have an ACER 5920G, and I ensure you, it has the bluetooth module installed), so I bought an external module to see if that was really the problem.
So I launched the same application below using the external bluetooth module, but the warning is always the same you see up.

I really don't know how to solve this, and it is a lot of time I'm on it, so I'd appreciate if anyone of you will give me an help or also some information that can help me to find a solution.

Thank you so much in advance!