I am trying to install Juniper Network connect 32 bit on my 64 bit Ubuntu 14.10. following the documentation here
Network connect needs the java 32 bit to be installed along with the 64 java.
those are some commands i used while installing java 64:
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jre1.8.0_31/bin/java" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jre1.8.0_31/bin/javaws" 1
sudo update-alternatives --set javaws /usr/local/java/jre1.8.0_31/bin/javaws
Next I installed java 32 under this directory Usr/local/Java32/jre.8.0_31.
Im trying as written in the tutorial to make Network Connect link to Java32 instead of java64 while jave 64 is the default. so I'm using this command line:
sudo update-alternatives --install /usr/bin/java java /usr/java32/jre1.8.0_31/bin/java 10.
But it is not working! i tried it different times with different changes and ofcourse i got this message:
too many levels of symbolic links
how do i undo all the update-alternatives i made? and what is the right way to link to java 32?
Use this command to start network connect which i am reproducing from the same juniper's page (there is a bug in the command. use -jar & not -cp as given by them). please note the NC.jar sits in your $HOME/.juniper_networks/
And in the command, for give java 6 bin path (in your case, /usr/java32/hre1.8.0_31/bin/java)
<java_path> -jar NC.jar -h <ivehostname> -u <username> -p <password> [-r <realm>]
-f <ivecertificate_in_der_format> [-l <gui_log_level> [-L <ncsvc_log_level>] [-y <proxy> -
z <proxy_port> [-s <proxy_username> -a <proxy_password> [-d <proxy_domain>]]]
Related
Well,I was trying to install forge on my linux machine(Kali-Linux).While on the was I was and still am unable to access the forge file(.jar).Due to an issue in which there is a lack of a command called "java".
The current problem I am having is sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-16.0.1/bin/java 1 while using this command I get a response as update-alternatives: error: cannot stat file '/bin/java': Too many levels of symbolic links.
When I try to ls in the /bin.The java symbolic link has a weird symbol(Just wanted to mention it cause it looked weird)
Is there anyway to fix this problem?
The "too many levels of symbolic links" message means that 40 symlinks have been traversed in attempting to resolve a path to an object.
It nearly always happens because you have a symlink that directly or indirectly points to itself. And the purpose of the limit (and the check) is to prevent the kernel going into an infinite loop.
So, why it is it happening here? Well, it is not entirely clear. But it seems like an earlier update-alternatives run has left some "wreckage" in the form of bad symlinks. If "/bin/java" already points to "/etc/alternatives/java", then "/etc/alternatives/java" should be a symlink to ... somewhere else.
Try the following:
Use update-alternatives --remove-all java to clear out any alternatives for the java command. (If this fails with the same problem, try step 2 first, then retry this step. Adding --force might help too.)
Remove the "/bin/java" and "/usr/bin/java" symlinks if they still exist.
Make sure that you have actually installed Java (already!), and "/usr/lib/jvm/jdk-16.0.1/bin/java" is the correct path for the executable. Run /usr/lib/jvm/jdk-16.0.1/bin/java -version to check.
Run sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-16.0.1/bin/java 1.
Note that update-alternatives does not actually install anything. For the command to work properly, you need to have installed (in this case) a Java JRE or JDK or a Kali Java package already.
Note that it cannot do any real harm to remove "alternatives" symlink chains that are broken. You can always clean them out and rebuild them. (By hand, if necessary.) The alternatives mechanism is just a fancy way of managing symlinks.
I found the solution. I'm putting it here with a clear explanation.
When you use this command sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-16.0.1/bin/java 1 to update java, there is already a symbolic-link of java file between these 3 directories /usr/bin/java -> /etc/alternatives/java and-> /lib/jvm/jdk-current-version/bin/java.
For updating alternatives first you need to remove the symbolic link at /lib/jvm/jdk-current-version/bin/java. Which will ultimately remove all links. Then you need to remove the java file from /usr/bin/java and /etc/alternatives/java.
Then run the update-alternatives command.
In my case, I did the following commands
rm symlink /usr/lib/jvm/java-11-openjdk-amd64/bin/java
update-alternatives --remove-all java for removing the java file.
rm /usr/bin/java if java file still exits in /usr/bin
then run the command update-alternatives --install /usr/bin/java java /opt/jdk/jdk-17.0.4.1+1/bin/java 100
or in your case it is sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-16.0.1/bin/java 1.
This will install new version of java into /usr/bin from the jdk directory you specified and automatically symbolic-links all the java files.
hello am trying to set environment for react native development, i followed all the steps in the get started guide, am trying to run the project on a Genymotion emulator, when i try to start the project i get an error message saying that i didn't set the java_home path, i watched a tutorial on how to do that, i think my problem is that am setting the path wrong... this is the path to java exe files from the tutorials :
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/java/jdk1.7.0_65/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/java/jdk1.7.0_65/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/java/jdk1.7.0_65/bin/javaws"
the path to those files in my computer is this :
/usr/lib/java/jdk-12.0.2_linux-x64_bin/data/usr/lib/jvm/jdk-12.0.2/bin$
so am wondering what to change.
..... this is a screenshot of ls "bin" !
To set JAVA_HOME environment variable, do the following:
Launch Terminal by pressing Ctrl+Alt+T on your keyboard.
Enter the following command:
$ gksudo gedit /etc/environment
Depending on where you installed your Java, you will need to provide the full path. For this example, I installed Oracle JDK 7 in the /usr/lib/jvm/java-7-oracle directory.Scroll to the end of the file and enter the following:
JAVA_HOME=/usr/lib/jvm/java-7-oracle
export JAVA_HOME
Save your file and exit gedit.
Lastly, reload the system PATH with the following command:
$ . /etc/environment
The above method will save you the hassle in having to run the commands every time you log in to your computer.
Previously, there was an easy way to install Java 8 on Ubuntu using webupd8team repository. But currently it does not work and packages are not located.
So after spending a lot of effort on such a common case I decided to add this post.
I used several resources to achieve it.
Uninstall openjdk sudo apt-get purge openjdk*
Go to this blog post and run all steps until 4. If you have issues on step #3 go to step 3 in this post (sorry for numbering :))
sudo mkdir /usr/lib/jvm-oracle
sudo cp ~/Downloads/(name of your tarball) /usr/lib/jvm-oracle
cd /usr/lib/jvm-oracle
sudo tar -xvzf (name of tarball)
cd jdk1.8.0_(corresponding version)
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm-oracle/jdk1.8.0_{version}/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm-oracle/jdk1.8.0_{version}/bin/javac 1
sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm-oracle/jdk1.8.0_{version}/bin/javaws 1
sudo cat > /etc/profile.d/jdk.sh
export JAVA_HOME="/usr/lib/jvm-oracle/jdk1.8.0_221"
export PATH="$PATH:${JAVA_HOME}/bin"
Ctrl+d
(Optional) Make sure java alternatives are updated sudo update-alternatives --config java
Update
You can download Java from here
Download the JDK 8 SDK.
Create a directory at /usr/lib called jvm-oracle. You will need to use the sudo command as this directory is at root level:
sudo mkdir /usr/lib/jvm-oracle
Copy your tarball over:
sudo cp ~/Downloads/(name of your tarball) /usr/lib/jvm-oracle
Move into the /usr/lib/jvm-oracle and extract your tarball:
Move into: cd /usr/lib/jvm-oracle
Extract: sudo tar -xvzf (name of tarball)
List out the directory contents and find your extracted folder:
ls -al
You should see a directory like ‘jdk1.8.0_172’. Move into your dir and the bin folder with cd and list out the contents.
Move to new dir: cd jdk1.8.0_172.
Move to bin: cd bin
List out Contents: ls -al
Run these following commands:
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm-oracle/jdk1.8.0_172/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm-oracle/jdk1.8.0_172/bin/javac 1
sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm-oracle/jdk1.8.0_172/bin/javaws 1
Then add the JAVA_HOME by these command:
echo $'\nJAVA_HOME='`which java` >> ~/.bashrc
Alternatively, you can add it manually by opening your .bashrc file and setting
JAVA_HOME=/usr/bin/java
I want to install jre 1.7 in a non interactive script.
is there a way to do that in equivalent of the following?
update-alternatives --config java
There are 3 programs which provide 'java'.
Selection Command
-----------------------------------------------
1 /usr/lib/jvm/jre-1.5.0-gcj/bin/java
*+ 2 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
3 /usr/lib/jvm/jre1.7/bin/java
Have a look at man update-alternatives. This reads:
--set name path
Set the program path as alternative for name.
This is equivalent to --config but is non-interactive
and thus scriptable.
[Message updated to include script and its output as you asked].
I have created a linux script which installs Oracle Java on Ubuntu.
The script is the following:
#!/bin/bash
# This script installs Oracle Java 7u51 jdk on Ubuntu Linux 64 bit
echo "Starting Oracle Java JDK Installation..."
sudo mkdir /usr/local/java
cd
sudo cp -r jdk-7u51-linux-x64.tar.gz /usr/local/java
rm jdk-7u51-linux-x64.tar.gz
cd /usr/local/java
echo "Unpacking java files in /usr/local/java"
sudo tar xvzf jdk-7u51-linux-x64.tar.gz
sudo rm jdk-7u51-linux-x64.tar.gz
sleep 1s
echo "Updating system Path file /etc/profile with Java variables"
sudo sed -i '$ a\JAVA_HOME=/usr/local/java/jdk1.7.0_51' /etc/profile
sudo sed -i '$ a\PATH=$PATH:$HOME/bin:$JAVA_HOME/bin' /etc/profile
sudo sed -i '$ a\export JAVA_HOME' /etc/profile
sudo sed -i '$ a\export PATH' /etc/profile
sleep 1s
echo "Updating alternatives"
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/
jdk1.7.0_51/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/
jdk1.7.0_51/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/
jdk1.7.0_51/bin/javaws" 1
sudo update-alternatives --set java /usr/local/java/jdk1.7.0_51/bin/java
sudo update-alternatives --set javac /usr/local/java/jdk1.7.0_51/bin/javac
sudo update-alternatives --set javaws /usr/local/java/jdk1.7.0_51/bin/javaws
sleep 3s
echo "Reload system wide Path /etc/profile"
. /etc/profile
sleep 3s
echo "Testing if Java is installed correctly. System must reply with Java version."
java –version
sleep 1s
javac -version
The script runs fine doing its thing and Java is installed correctly.
But the java -version command at the end gives this output at the terminal.
Testing if Java is installed correctly. System must reply with Java version.
Error: Could not find or load main class –version
javac 1.7.0_51
Two things baffle me.
The first is that the javac -version commands works in the script but not the java -version command.
The second is that if I go to the terminal right after the script has ended and input myself java -version, it works.
The install may be adding to the PATH, which you won't see from inside the current shell. Try it with
sh -c java -version
Maybe, you can change the calling order, you can call the reload system wide Path operation before the update-alternatives operations.