Disclosure: I work for License4J.
You can use a combination of hostname, mac address, disk volume id etc as a hardware ID, so it works on both physical and virtual machines. Trial license is just a normal license with a limited validity period (e.g. it expires after 30 days). You can also query available ntp servers to validate license expiry, so system clock change can be detected.