You can not force garbage collection. Only you can call System.gc() which simply is a hint to the garbage collector that you want it to do a garbage collection.
There is no way to force and immediate collection though as garbage collector is non-deterministic.