JAVA_HOME path in Linux EC2 - linux

I had open JDK installed in my Linux EC2. But then i installed oracle JDK.
As i wanted to set oracle JDK path for all users i have set in
/etc/profile
When i do echo $JAVA_HOME.It shows me correct path of oracle JDK.
But when i do it shows me path of openJDK.
$env
JAVA_HOME path showing open JDK
Please suggest why JAVA_HOME is still pointing to openJDK and how to make it point to oracle JDK for all users.I have reboot the system but its still showing openJDK path when i do env.

From https://superuser.com/questions/664169/what-is-the-difference-between-etc-environment-and-etc-profile
/etc/environment - This file is specifically meant for system-wide environment variable settings. It is not a script file, but rather consists of assignment expressions, one per line. Specifically, this file stores the system-wide locale and path settings
You may be seeing environment variables for a non interactive shell. Non interactive shells do not invoke /etc/profile.
Try setting the path in /etc/environment instead. This is the correct file to use for setting the system path.

Related

How to open VSCode from a Windows Linux Subsystem?

I have VSCode installed on my host OS which is Windows 10 on which I have an Ubuntu Subsystem terminal (WSL) and I'm trying to open VSCode from whitin it with this command code . The problem is that the output is Command 'code' not found. How can I make this work?
Assuming you have installed VSCode in its default place, then in WSL you can do :
PATH="$PATH:/mnt/c/Users/your-user-name/AppData/Local/Programs/Microsoft VS Code"
and run code.exe .
First, try installing the Remote - WSL extension in VSCode (or the meta Remote Development extension pack, which includes the WSL work).
I doubt that's your main problem, but it could help.
Next, try running code . under PowerShell - Does that work? If not, then VSCode isn't in the Windows path. Try reinstalling it -- If it's not in the path, some other associations may not be correctly installed either. I don't recall if there's an option during installation to add or not add it to the Windows path, but if so, it could be that it was deselected during installation.
If it does launch in Windows, then obviously it's in the Windows path. By default, WSL appends the Windows path to the default path in Ubuntu during init. So (again, by default) code . should work in WSL if it is working under PowerShell.
Check your $PATH under Ubuntu (echo $PATH). Is the .../Microsoft VS Code/bin directory (wherever it is installed) in the path? If not, then WSL may not be doing its default append. Edit /etc/wsl.conf under Ubuntu and look to see if there's an [interop] section, as in:
[interop]
appendWindowsPath=false
If so, then change it to true (or, delete it entirely) to allow WSL to add the Windows path. While it's the default setting if missing, you might try adding it and setting it to true (although that shouldn't have any effect).
If that still doesn't work, then check your startup scripts (e.g. .profile, .bash_profile, .bashrc) to see if there are any modifications to the PATH which could be causing this problem.

Configuring Lauch configuration using anaconda and KDevelop

How do i configure Kdevelop enviroment on windows to point to my anaconda python installation. I have already set the path on windows. The configure enviroment variable does not have the option to put the path rather it gives the option to enter variable and value.
!https://drive.google.com/open?id=1zcfVGZb8-bKGkw9ww2I4PjBa8yIH9QvG

Unable to find JAVA_HOME

I copied the latest java 1.8 to a red hat Linux server. I ran the command java -version and it returned version 1.7.0_131. I updated .bashrc and the jre to the latest version 1.8. When I run the command version java -version it still says its version 1.7.0_31. What I need to know where is this being picked up from. I have checked .profile, .bashrc and JAVA_HOME they all are pointing to the location where I update to 1.8. Greatly appreciate all your help.
Type which java and you will probably see (at least after you have followed all the symlinks) that the Java executable is taken from somewhere else than your newly set JAVA_HOME. You need to create the appropriate symlinks to version 1.8, too, like this:
ln -s /your/path/to/v18/bin/java /usr/bin/java
Be aware that existing applications might use the 1.7 Java version and you might break them when you set /usr/bin/java (or whatever path the which command showed you) to the 1.8 version.
Fyi, JAVA_HOME is not meant to be used by your shell to locate the Java command. It is to be used by other software that require Java to know where to find it.
Do it like this once
export JAVA_HOME=/jdk/path
If you use it continuously, add the above code to your .bashrc file or profile. Then open new terminal or run below code
source .bashrc

Cygwin - export vs. SET

I have written a little bash script to switch the JAVA Version in Cygwin: http://pjsdev.blogspot.de/2013/02/cygwin-switching-java-version.html
As you can see I am using "export" to set the ENV & PATH. This works fine in command line tools running under Cygwin shell. But how can I force to set the Variables in Win7 advanced system settings? In a batch script SET would be the command to use, but are there any posibilities in Cygwin to call SET or something similar?
Take a look at How to Call the Windows API From a Cygwin Program, as you will have to call out to Windows to change the Environment for Windows programs.

Where can I download JDK without installation Ubuntu 9.10?

I have Ubuntu 9.10, and Im not a root. This server contains JDK, but I need some updates (change local policy), and its easy for me to use package Java. E.g. on Windows I downloaded jdk1.6.0_05, set JAVA_HOME, and didn`t have any problems.
Is it possible to download full JDK to my home directory, export $JAVA_HOME without any installation manipulation?
Download the jdk Linux "bin" version from Oracle's web site. Wherever directory you run the shell script, it will install the jdk. Very similar to unpacking a .tar.gz.
http://www.oracle.com/technetwork/java/javase/downloads/index.html
Update your JAVA_HOME and PATH, etc, and you should be good to go!
You can download the JDK from here. If you are able to modify the server's environment, you can try to modify the $JAVA_HOME. If your server is running with lower privileges under another user, you have to do this with this user.
Download the java .deb package and unpack it with
dpkg -x <deb> .
You will get a /usr dir with subdirs and java distribution.
Copy it to wherever you like and set JAVA_HOME.

Resources