can't find Couldn't find the remote XBee device with 'REMOTE' Node Identifier.

Hello

I’m using netbeans and compiled this code ;
public class XbeeTest2 {

    private static final String PORT = "COM4";
// TODO Replace with the baud rate of your sender module.
private static final int BAUD_RATE = 9600;

private static final String DATA_TO_SEND = "Hello XBee!";
private static final String REMOTE_NODE_IDENTIFIER = "REMOTE";
/**
 * @param args the command line arguments
 */
public static void main(String[] args) {
            System.out.println(" +--------------------------------------+");
	System.out.println(" |  XBee Java Library Send Data Sample  |");
	System.out.println(" +--------------------------------------+

");

	XBeeDevice myDevice = new XBeeDevice(PORT, BAUD_RATE);
	byte[] dataToSend = DATA_TO_SEND.getBytes();
	
	try {
		myDevice.open();
		
		// Obtain the remote XBee device from the XBee network.
		XBeeNetwork xbeeNetwork = myDevice.getNetwork();
		RemoteXBeeDevice remoteDevice = xbeeNetwork.discoverDevice(REMOTE_NODE_IDENTIFIER);
		if (remoteDevice == null) {
			System.out.println("Couldn't find the remote XBee device with '" + REMOTE_NODE_IDENTIFIER + "' Node Identifier.");
			System.exit(1);
		}
		
		System.out.format("Sending data to %s >> %s | %s... ", remoteDevice.get64BitAddress(), 
				HexUtils.prettyHexString(HexUtils.byteArrayToHexString(dataToSend)), 
				new String(dataToSend));
		
		myDevice.sendData(remoteDevice, dataToSend);
		
		System.out.println("Success");
		
	} catch (XBeeException e) {
		System.out.println("Error");
		e.printStackTrace();
		System.exit(1);
	} finally {
		myDevice.close();
	}
}

======================================

however this is what I get

run:
±-------------------------------------+
| XBee Java Library Send Data Sample |
±-------------------------------------+

WARNING: RXTX Version mismatch
Jar version = RXTX-2.2pre1
native lib Version = RXTX-2.2pre2
Couldn’t find the remote XBee device with ‘REMOTE’ Node Identifier.

==================================

the Xbee works fine with the Xctu

thanks

I am not fully sure but I think that the Java Lib uses the radios in API mode. you may want to check the document for the Java lib to verify this.

thanks for your answer, I’ve modifyed the API mode

I would strongly recommend reading over https://docs.digi.com/display/XBJLIB/Configuring+the+XBee+device.

I think you may find that you need to use the ND command to discover the network.