Solved

Java upgrade to 7

Posted on 2013-05-17
14
394 Views
Last Modified: 2013-05-17
I have a computer with an old version of Suse (10.2).  Upgrading the operating system at this time is not an option.  I have a program that requites java 7.  I downloaded the rpm file jre-7u21-linux-i586.rpm and executed the following command.

rpm -i  jre-7u21-linux-i586.rpm

I executed properly but when I run the program the same error occurs

Bad version number in .class file

I am obviously not getting this done properly or completely and need a hand.

Thanks!
0
Comment
Question by:sargent240
  • 7
  • 4
  • 2
  • +1
14 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 39175027
You need to prepend the bin directory of the new version to PATH and preferably set JAVA_HOME to the new installation dir

If you do both, do them in the opposite order ;)
0
 

Author Comment

by:sargent240
ID: 39175104
As you have become aware over the past few months CEHJ I know enough about java and Linux to be dangerous.  After looking a little around the web I executed the following commands.

export JAVA_HOME=/usr/java/jre1.7.0_21/bin/java

Followed by

export PATH=$PATH:/usr/java/jre1.7.0_21/bin

Again, obviously I don't know what I am doing as the same problem occurs
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 39175138
Close, but not quite right:

export JAVA_HOME=/usr/java/jre1.7.0_21
export PATH=${JAVA_HOME}/bin:$PATH

Open in new window


But i suspect you should be using a JDK, not a JRE ...
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 39175143
You should probably make those two lines the last ones of ~/.bashrc
0
 
LVL 3

Expert Comment

by:GhostInTheMacheen
ID: 39175145
JAVA_HOME should be the path to the java directory, not the binary.

Also, echo $PATH and make sure you don't still have the Java 6 path in there. You are appending the Java 7 bin path to the end, and it will look in the directories in sequential order.
0
 
LVL 3

Expert Comment

by:GhostInTheMacheen
ID: 39175149
Quick response cehj ;)

But I'm glad to see we agree.
0
 
LVL 16

Expert Comment

by:Valeri
ID: 39175153
Just try to uninstall old jre's. what is the result of this command?
java -version


the following is the info how to uninstall old jre:
====================================================================
Java Uninstall
 There are two ways to uninstall Java. Please use the method that you used when you installed Java. For example, if you used RPM to install Java, then use the RPM uninstall method.
 
RPM uninstall
 Note: If you have RPM on your Linux box, you should first find out if Java is already installed using RPM. If Java is not installed using RPM, you should skip reading.1.Open Terminal Window
2.Login as the super user
3.Try to find jre package by typing: rpm -qa
4.If RPM reports a package similar to jre-<version>-fcs, then Java is installed with RPM.

 Note: Normally, you do not need to uninstall Java with RPM, because RPM is able to uninstall the old version of Java when installing a new version! You may skip reading, unless you want to remove Java permanently.
5.To uninstall Java, type: rpm -e jre-<version>-fcs
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:sargent240
ID: 39175246
CEHJ, I looked around for the jdk and noticed it is the development kit for writing java apps.  Do I need that if all I am going to do is execute a java program on the Suse 10.2 computer.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 39175377
No you probably don't - but i got the idea (obviously wrongly ;)) that you did write stuff
0
 

Author Comment

by:sargent240
ID: 39175440
OK, I will proceed.  I do write some stuff but that is done on another computer and I am trying to get the results to run on the 10.2 computer.  I will continue and let you know.  
I have included by .bashrc file below in case you see something I have incorrect.  I'll keep working on it in the mean time.

Thanks.


# Sample .bashrc for SuSE Linux                                                            
# Copyright (c) SuSE GmbH Nuernberg                                                        
                                                                                           
# There are 3 different types of shells in bash: the login shell, normal shell            
# and interactive shell. Login shells read ~/.profile and interactive shells              
# read ~/.bashrc; in our setup, /etc/profile sources ~/.bashrc - thus all                  
# settings made here will also take effect in a login shell.                              
#                                                                                          
# NOTE: It is recommended to make language settings in ~/.profile rather than              
# here, since multilingual X sessions would not work properly if LANG is over-            
# ridden in every subshell.                                                                
                                                                                           
# Some applications read the EDITOR variable to determine your favourite text              
# editor. So uncomment the line below and enter the editor of your choice :-)              
#export EDITOR=/usr/bin/vim                                                                
#export EDITOR=/usr/bin/mcedit                                                            
                                                                                           
# For some news readers it makes sense to specify the NEWSSERVER variable here            
#export NEWSSERVER=your.news.server                                                        
                                                                                           
# If you want to use a Palm device with Linux, uncomment the two lines below.              
# For some (older) Palm Pilots, you might need to set a lower baud rate                    
# e.g. 57600 or 38400; lowest is 9600 (very slow!)                                        
#                                                                                          
#export PILOTPORT=/dev/pilot                                                              
#export PILOTRATE=115200                                                                  
                                                                                           
export JAVA_HOME=/usr/java/jre1.7.0_21
export PATH=$(JAVA_HOME)/bin:$PATH

test -s ~/.alias && . ~/.alias || true
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 39175454
Yes that looks ok. Just remember you might want to fix that JAVA_HOME if and when you install a JDK
0
 

Author Comment

by:sargent240
ID: 39175465
OK, good advice.  It still does not work and whenever I bring up a konsole the top line says,

bash: JAVA_HOME: command not found

then I get the command prompt as usual
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 39175483
Hang on - there IS an error. You copied my post wrongly (am i getting deja vu at this error?)

WRONG
export PATH=$(JAVA_HOME)/bin:$PATH

Open in new window

RIGHT
export PATH=${JAVA_HOME}/bin:$PATH

Open in new window


(you use brackets, i use curly braces)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 39175678
:)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
groupSum6 challenge 6 48
Systems talking to each other 5 110
People Counting Software 2 62
Changing passwords in Linux Systems 3 19
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now