A novel computer simulation technique for studying fluids in confined geometries has been developed and used to replicate Pfeffer's experiment on osmosis in semipermeable membranes in 1877. Our results confirm the validity of van't Hoffs famous relationship for osmotic pressure over a wide range of concentrations, and also clearly establish its validity even for molecular systems. We believe this is the first theoretical validation of this result for such a wide range of concentrations, where no explicit assumption of ideality is made for the interactions of the solute molecules.