To get java we can install jdk. OpenBSD 6.1 have 2 packages of jdk which is 1.7 and 1.8.
To install jdk package do pkg_add jdk then choose which version you want to install.
pkg_info of jdk 1.8 as follow

After installing , we need to add java bin to PATH and set JAVA_HOME to java install dir. A way to this is edit your .profile file on home dir. I use nano to edit my .profile.

If you dont have nano yet, just add it with pkg_add nano.
Logout then login again to activate the changes to .profile file and after that try running java -version.

Done for now.