I need to run eclipse(java 1.7) and STS 3.8.1 ( java 1.8) but if i select the java 7 as default i am getting error in the STS 3.8.1.
I am using OS : ubuntu 14.10
The STS 3.8.1 all-in-one distribution is based on Eclipse v4.6 which required Java 1.8 to start it.
As @Jens mentioned, you can to Open Windows -> Preferences. Then open tree node Java > Installed JREs. After adding a new JRE/JDK, you can set it as default or delete others items.
Another option: if you have installed Eclipse 4.5, please visit https://spring.io/tools/sts/all
Help -> Install New Software.... Just paste update site URL in the Wizard.Add... button in the same Wizard, select the folder of unpacked zip file.