Jay, I can help you if you want code samples, but if all you want to do is test the electronics of a TMCC engine the following might be easier than figuring out how to program your serial port:
1) Construct a few 3-byte TMCC commands (0xFE 0xXX 0xXX) using the Lionel command reference, either by hand or by a program you write in java. The basic code to do that is this:
byte 2 = deviceType | (deviceID >> 1); // Byte 2 is combination of type field and first 7 bit of TMCC address
byte 3 = (deviceID << 7) | (commandField << 5) | dataField; // Byte 3 is last bit of TMCC address, command field (2 bits), plus data field
2) Using a serial monitor program that can send hex data out the serial port, just type in those hex sequences and send to the command base.