Red Hat Linux Enterprise 5.7 remove Java - java

I need to uninstall Java jdk1.6.0.27 from RHEL 5.7 and then install another version jre-7u40-linux-x64.rpm.
The firs thing I did was to find out the current java version installed using the
java -version command and the output is "java version "1.6.0_27"".
After that I tried to check the previews version of java with the command:
rpm -qi jdk
The output is "package jdk is not installed"
After installing the package jre-7u40-linux-x64.rpm in the /usr/java directory there are two java packages.
The output of the ls command on /usr/java is:
default jdk1.6.0_27 jre1.7.0_40 jre-7u40-linux-x64.rpm latest.
when I run the command "alternatives --config java" the output is:
*+ 1 /usr/java/latest/bin/java
I am new to RHEL and I need some help to understand the situation.
To conclude I need some help to remove the previews jdk1.6.0.27 and to install jre1.7.0_40.
Thank you in advance for your help!
Best regards,
Claudio

First, find out your real java executable. Start with
which java
This is going to give you some response such as:
/usr/bin/java
Next, do
ls -l /usr/bin/java
(Or whatever it returned).
It will probably write something like:
/usr/bin/java -> /etc/alternatives/java
Do the same for whatever is pointed to by the arrow, until finally, when you do ls -l on it, there is no arrow.
Then, for that particular file, find out which rpm provides it by using
rpm -q -f <full path of the file you found>
It should tell you which package it belongs to, and then you can uninstall that.
However, if the rpm command returns The file ... is not owned by..., then your Java has not been installed using an rpm. It may have been installed manually by someone in the past.
This makes uninstalling it a lot more problematic.

If you haven't found your answer:
leave old java where it is, don't even bother with it
install new version with: rpm -ivh /root/jdk-7u40-linux-x64.rpm
deactivate old java
export new version
Deactivating old java (note entering hashtags before every line, manual installation required editing of profile, so edit it one more):
vi /etc/profile
#JAVA_HOME=/usr/java/jdk1.6.0_27
#export JAVA_HOME
#PATH=$JAVA_HOME/bin:$PATH
#export PATH
Exporting nev version (note adding new lines in profile followed after old entries):
export JAVA_HOME=/usr/java/latest
export JRE_HOME=$JAVA_HOME/jre
export J2RE_HOME=$JAVA_HOME/jre
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$J2RE_HOME/bin:$PATH
Check nev version with standard command for checking of installed sw.
Hope this suits your needs.
Just wondering: you're trying to prepare BFBOX for acceptance? Just courious! If you want more info please send me an email, ok?

Related

Eclipse Error for GLPK library: The dynamic link library for GLPK for Java could not beloaded

I have a java program in which a use the GLPK Solver. The error that i receive when i run it on eclipse is the following:
The dynamic link library for GLPK for Java could not beloaded.
Consider using
java -Djava.library.path=
The current value of system property java.library.path is:
/Users/maria/Documents/solver_library/GLPK/w64
I had the same problem on my old windows computer and i solved it doing the following:
1. Adding in the Java Build Path->Libraries the glpk-java.jar file
2.Adding as the Native library location of the above jar the corresponding path (C:\ProgramFiles\solver_library\GLPK\w64
3. adding in the PATH environment variable the above path.
I am doing exactly the same things on my new MAC OS X computer but still receiving the above error. I did with exactly the same way the steps 1 and 2 above and also I modified through the terminal the PATH system variable. This now is:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/maria/Documents/solver_library/GLPK/w64
Could you please tell me if you have any idea of how to solve this? I am a new Mac user so i don't know many things.
Thanks in advance!
Here's what I did to make it work on OS X.
Install glpk.
I used for this homebrew
$ brew install glpk
$ brew install swig // this package we well need for glpk for java
Install glpk for java http://sourceforge.net/projects/glpk-java/files/glpk-java/
Unzip the archive with:
$tar -xzf glpk-java-1.0.37.tar.gz
$cd glpk-java-1.0.37
Configure with:
$./configure \
CPPFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers \
SWIGFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers
Make and install with:
$make
$make check
$make install
Now in swig dir you should have 3 jars:
glpk-java.jar, glpk-java-sources.jar, glpk-java-javadoc.jar and the .lib folder (hidden).
For compiling you need to put glpk-java.jar in your classpath and specify javac option -Djava.library.path=/YOUR_PATH/libglpk-java-1.0.37/swig/.libs

Modifying JDK Path for Oracle SQL Developer in Ubuntu

I have Oracle SQL Developer installed at the following location:
/opt/sqldeveloper
Every time I run it using the command ./sqldeveloper, I get the following error from the GUI:
You are attempting to run with Java 1.6.0_31. Running this product is
supported with a minimum Java version of 1.7.0_51 and less than 1.8
I updated the sqldeveloper.conf file with the following paths:
/usr/java/jdk1.8.0_05
and
/usr/java/jdk1.7.0_55
And despite all that, same error again.
I know I am a bit late with the response, but I had exactly the same issue until this morning.
What I did is changed:
~/.sqldeveloper/4.0.0/product.conf
FYI:
How I figure it out:
1. Go to OracleSQLDeveloper -> Help(menu) -> Properties
2. Find 'java.home'
(For some reason it was pointing to /usr/lib/jdk1.7.0 (ver 1.7.45), even I've changed sqldeveloper.conf)
3. Since I didn't recognized that specific version, I just ran:
sudo "find / .... -name '*.conf' -exec grep 'jdk1.7.0' ..."
goodluck
Configure Path to Java
SQL-Developer needs to know how to find your Java Developer Kit:
Note: You need to specify /usr/lib/jvm/java-6-openjdk-i386 on 32-bit OS installations.
Terminal
cd $HOME
mkdir -p .sqldeveloper
cd $HOME/.sqldeveloper
echo "/usr/lib/jvm/java-6-openjdk" > jdk

How to install java 7 on mac in custom location?

I want to install java 7 on mac silently. I am unable to find any documentation/links on the same. Also I don't want it in /Library. Is it possible to install the same on any custom location. I am very new to mac any help is highly appreciated.
Just to make the steps from #HawkMage more explicit (and illustrate them working with JDK8):
Download the binary (eg, jdk-8u5-macosx-x64.dmg) from Oracle
Double click from Finder to mount the Volume. Ignore the window with the “JDK 8 Update x.pkg”
Use pkgutil to expand the contents of the package into a temporary directory:
$ pkgutil --expand /Volumes/JDK\ 8\ Update\ 05/JDK\ 8\ Update\ 05.pkg /tmp/jdkpkg
Then, change to that dir and use cpio to expand the Payload file:
$ cd /tmp/jdkpkg
$ cpio -i < ./jdk18005.pkg/Payload
Finally, move the Home dir to wherever you’d like your JAVA_HOME to live
$ mv Contents/Home /mytools/jdk-1.8.0_05
Unfortunately the "standard" Java that comes on OS X is packaged in a very non-standard way.
It is not as easy as linux, the DMG downloaded gives you a PKG file that if you run it just installs Java. This is not useful if you are trying to keep the standard Java that comes with OS X intact.
What I do is download the DMG file from Oracle and open it but instead of running the PKG I use pkgutil to extract the contents of the package. You will find a directory named jdk*.pkg and in it you will see a file named Payload. This is a GZipped CPIO file and you can extract it by cating it and piping it into cpio -zi. From this you will now have a directory named Contents and under it you will find a directory named Home. This "Home" directory is the what you would normially get with the Linux tar.gz Java download. You can copy it to wherever you want and put the bin directory in your path and set the JAVA_HOME to it and you are good to go.
Just like in Linux, you can pretty much install Java anywhere you like on a mac. You just need to make sure that you add the Java executable to the path or create a symbolic link of the java executable and put it in the /usr/bin/ directory so it can be executed anywhere.
To add Java to path:
1) Modify .bash_profile found in your home director.
2) Add this line: export PATH=/yourjavadir/bin:$PATH
3) Save and exit
4) Then do source .bash_profile to reload the file. You'll only need to do this one time.
To create a symbolic link:
ln -s /yourjavadir/java /usr/bin/java
I had the same issue and just managed to figure it out.
Download and unzip the Java binary in your custom directory. For eg -
/Users/myuser/Documents/jre1.8.0_25.jre
Update your .bash_profile with the following parameters
export JAVA_HOME=/Users/a514624/Documents/jre1.8.0_25.jre/Contents/Home
export PATH=$PATH:$JAVA_HOME/bin
Close the terminal window and open it again. Alternately, you could type the command 'source .bash_profile'.
After these steps, if you type java -version on the command prompt, you would see it reflecting the version which you were hoping to see -
$ java -version
java version "1.8.0_25" Java(TM) SE Runtime
Environment (build 1.8.0_25-b17) Java HotSpot(TM) 64-Bit Server VM
(build 25.25-b02, mixed mode)
Unlink the existing Java softlink (would require root/elevated privileges)
root$ unlink /usr/bin/java
Create a symbolic link to the new Java installation
root$ ln -s /Users/myuser/Documents/jre1.8.0_25.jre/Contents/Home/bin/java /usr/bin/java
Thats it. Life is beautiful after this. Hope this helps!
If you just need JRE/Java Runtime Edition then previous answers arecorrect but if you need JRE and JDK (Java Development Kit) then simply go to below link and select the mac and run the dmg and it's much better and by far the easiest.
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

How to change the default compiler?

I have javac complier installed on my mac mashine. By default its version is 7. I want to set complier version to 6 by default. How do I do it on Mac?
Ive found simular solution for ubuntu:
http://bartling.blogspot.com/2007/03/getting-java-6-to-be-default-jvm-on.html
$ export JAVA_HOME=/usr/libexec/java_home -v '1.6*'
Run a command which exports your configuration:
export JAVA_HOME=/usr/libexec/java_home -v '1.6*'
This would last only until you restart your computer, so be sure to include it to your configuration as well. I'm not an OSX user so I'm not sure how exactly is the file called, but it's basically and equivalent of ".bashrc" on Linux. Just put the export line on the end of the file, so it will export it every time in future. (It's probably the same file because they're both UNIX based)

run .jar file with "java" command Centos

I'm trying to run a .jar file on my centos box, but it says "java: command not found".
What's the best or easiest way to solve this? I was hoping for a yum command but not sure that that will exist for java?
Apparently some versions of CentOS doesn't come with a JVM installed due to some licensing restriction. See HowTo Install Java on CentOS 4 and CentOS 5 for instructions.
You can use such command to check if Java is available in your repository:
yum list | grep java
It should return something like that:
java-1.6.0-openjdk
java-1.6.0-sun
If such package exists you can install it using such command (run it as the root user):
yum install java-1.6.0-openjdk
Either the JRE is not installed or, more likely, its location is not included in your PATH environment variable. If the java executable is not in your PATH, you would need to use the full path & filename to execute it.
cd to the location of the jar file
C:\temp>java -jar sample.jar

Categories