Ok, I go back deeper in Rpi own config and I think we gonna make it works:
1- You must login as pi user (the default account, when you install raspbian. Default password is "raspberry")
You can open a new session with "pi" user (easier)
Or, you can use your own account then do a "su pi". When you've finished, "exit" command get you back to you own session.
2- Do both commands ("pi" user is allowed to do so, but your own account isn't):
sudo echo "export JAVA_HOME="/opt/jdk1.8.0"" >/etc/profile.d/jdk1.8.sh
sudo echo "export PATH=$PATH:$JAVA_HOME/bin" >>/etc/profile.d/jdk1.8.sh
3- That's all. You can logout "pi" or reboot and try to launch OH to check that it's ok... or not.
To go ahead... if you got some time.
Next, if you don't want to log as "pi" user each time you need to do a "root" command, you can update the /etc/sudoers file. You must do that with your "pi" user session. Simply duplicate the last line: To avoid using the "beautifull and powerfull" vi or nano editors, you can just do:
sudo cp /etc/sudoers /etc/sudoers.BAK (Keep a copy of the original file, just in case...)
sudo cat /etc/sudoers (Display file content. The last line will be something like : "pi ALL=(ALL) NOPASSWD: ALL")
Add a new line at the end of the file, replace "pi" with your own user account. In my case I'll do
sudo echo "gilles ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers
You can now leave "pi" session and open a new one with your own account and check that you can do a "sudo". To check, you can do a "sudo su" (be carefull, you're now the root user), and if there is no error message, see that the last character of your prompt isn't "$" anymore, but "#", which means you're login as root user. Do "exit" command to go back to your session, note the last "$" at the prompt.
Let me know if it's ok now
Gilles