Uninstall every single java you have currently. Download the latest 64-bit java https://java.com/en/download/manual.jsp
Sometimes if you have a more than one version of java installed, it will use the older one.
Make sure the only java command you are using to launch your server is " java -Xmx4G -Xms4G -jar yourjarname.jar "
1