When you define it in your .bashrc file, it will be OK and well defined for your user.
When you launch the command with sudo, it runs as super-user/root, and NOT as your user; so your .bashrc file is 'useless' in this case.
You should update your environment with a system file like something under /etc/profile.d for instance:
sudo touch /etc/profile.d/variousPath.sh
sudo chown bsquare /etc/profile.d/variousPath.sh
cat >> /etc/profile.d/variousPath.sh <<EOF
export JAVA_HOME=/home/manish/New_learning/jdk1.8.0_212
export PATH=$JAVA_HOME/bin:$PATH
EOF
Reboot your computer, and your SYSTEM environment will know $JAVA_HOME
.