Arduino due and serial monitor

Can you use the serial monitor with arduino due. If so how?
The usual way you use the serial monitor with mega etc doesn't seem to work with Due.

I have been googling for 30 minutes. There is PLENTY on how to debug regular arduinos, but nothing specifically on how to debug a Due. Clearly they are not the same because the serial monitor is not working with my due.

Surely someone somewhere has written a tutorial on how to debug a sketch on a due?????

I found this:

Native port

Opening and closing the ''Native' port at the baud rate of 1200bps triggers a “soft erase” procedure: the flash memory is erased and the board is restarted with the bootloader. If, for some reason, the MCU were to crash during this process, it is likely that the soft erase procedure wouldn't work as it's done in software by the MCU itself.

Opening and closing the Native port at a baudrate other than 1200bps will not reset the SAM3X. To use the serial monitor, and see what your sketch does from the beginning, you'll need to add few lines of code inside the setup(). This will ensure the SAM3X will wait for the SerialUSB port to open before executing the sketch:
while (!Serial) ;

But it is not enough information! Because the native port is even recognized by windows as a com port.

Make sure you have selected "Programming Port" for both "Board" and "Port" in the Tools menu.
The Serial Monitor will be available.

If you use "Native USB Port" for both "Board" and "Port", the Serial Monitor will not be available because it is shared with the Programming Port.

Yeh I have 'programming' for both board and port but serial monitor is still not working.

I know if you forget to call Serial.begin(...) with Mega etc then you get the same problem.

So I have this in my setup function:

#ifdef __SAM3X8E__
  SerialUSB.begin(115200);
  while (!SerialUSB);
#endif
  Serial.begin(115200);
  while (!Serial);

Do you need to do something different with Due?

Just

Serial.begin(115200);

doesn't work? (works OK on my Due R3)

Simple test sketch ...

byte count = 0;

void setup() {
  Serial.begin(115200);
}

void loop() {
  Serial.print ("Count = ");
  Serial.println (count);
  count++;
  delay(500);
}

OK the simple test sketch works, so it must be some other Mega specific thing that I have done that is interfering with it.

Ah! Due doesn't like the wire library I am using that is dragged in by RealTimeClockDS1307.h

So I presume there is a wire.h library that is compatible with Due. Where would I find it?