Unlike Unix or Linux, there is not portable installer. Instead we need to make it by installing on a test machine and copying the directory out to your target computer.
To quickly get started, go to the Windows Portable Java Packages Downloads area.
To make your own portable version begin by setting up a test machine that matches the platform you need. We usually use VMWare to easily create test machines without the need for additional hardware.
Go to the Java website, choose the JRE or JDK based on your platform and needs. Download the requisite installer file and install with default settings on your test machine. For older versions of Java go to the Java Archives site.
Once setup, there will be a "C:\Program Files\Java" directory.
Simply copy the Java directory and place it on your target machine. Java runs fine without being bound to the Windows registry.
You may be interested in how to Manually Setup Java on Ubuntu Linux.