LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices

Reply
 
Search this Thread
Old 12-03-2008, 11:14 AM   #1
Setya
Member
 
Registered: Apr 2007
Posts: 41

Rep: Reputation: 15
Linking does not work as expected


Hi all,

From Xubuntu 8.10, I want to run certain program from any folder where I'm currently in, AFAIK I can do this by using 'update-alternatives' command for example :

Code:
sudo update-alternatives --install /usr/bin/java java Programs/jdk1.6.0_07/jre/bin/java 300
With above command I hope I can invoke 'java -version' from anywhere, but everytime I invoke it, Xubuntu always throws the following message :

Code:
The program 'java' can be found in the following packages:
 * java-gcj-compat-headless
 * cacao-oj6-jre-headless
 * gij-4.2
 * kaffe
 * cacao
 * openjdk-6-jre-headless
 * jamvm
 * gij-4.3
 * sablevm
Try: sudo apt-get install <selected package>
bash: java: command not found
It seems that Xubuntu has ignored the link created and keep telling me to install the package.

I've just migrated from Fedora and it worked as expected there.

Any help would be greatly appreciated.


Regards,

Setya
 
Old 12-03-2008, 11:16 AM   #2
jay73
Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
Have you got an internet connection? Just install it from the repositories, waaaay more convenient.
 
Old 12-03-2008, 11:26 AM   #3
Setya
Member
 
Registered: Apr 2007
Posts: 41

Original Poster
Rep: Reputation: 15
Thanks for your response.

Yes, I have internet connection.

It's because I just want to work with certain version of JRE and it's already exploded somewhere in my home directory so I just want to be able to call it from anywhere I want.

Beside, Ubuntu repositories may not have the correct version of JRE.


Setya
 
Old 12-03-2008, 11:37 AM   #4
jay73
Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
Frankly, I do not see how 1.6.07 or 1.6.10 is going to make a difference. But OK, if you insist on using your own: here is a script to make sure that at least the most vital parts of your jdk are properly configured - and this is only to install, you still need to run update-alternatives --configure after this. By the way, you will need to replace all the
/opt/jdk1.6.0_10_x64
by
Programs/jdk1.6.0_07
to suit your case.

Quote:
#! /bin/bash

/usr/sbin/update-alternatives --install /usr/bin/java java /opt/jdk1.6.0_10_x64/bin/java 55
/usr/sbin/update-alternatives --install /usr/bin/javac javac /opt/jdk1.6.0_10_x64/bin/javac 55
/usr/sbin/update-alternatives --install /usr/bin/jar jar /opt/jdk1.6.0_10_x64/bin/jar 55
/usr/sbin/update-alternatives --install /usr/bin/appletviewer appletviewer /opt/jdk1.6.0_10_x64/bin/appletviewer 55
/usr/sbin/update-alternatives --install /usr/bin/apt apt /opt/jdk1.6.0_10_x64/bin/apt 55
/usr/sbin/update-alternatives --install /usr/bin/extcheck extcheck /opt/jdk1.6.0_10_x64/bin/extcheck 55
/usr/sbin/update-alternatives --install /usr/bin/idlj idlj /opt/jdk1.6.0_10_x64/bin/idlj 55
/usr/sbin/update-alternatives --install /usr/bin/jarsigner jarsigner /opt/jdk1.6.0_10_x64/bin/jarsigner 55
/usr/sbin/update-alternatives --install /usr/bin/javadoc javadoc /opt/jdk1.6.0_10_x64/bin/javadoc 55
/usr/sbin/update-alternatives --install /usr/bin/javah javah /opt/jdk1.6.0_10_x64/bin/javah 55
/usr/sbin/update-alternatives --install /usr/bin/javap javap /opt/jdk1.6.0_10_x64/bin/javap 55
/usr/sbin/update-alternatives --install /usr/bin/jconsole jconsole /opt/jdk1.6.0_10_x64/bin/jconsole 55
/usr/sbin/update-alternatives --install /usr/bin/jdb jdb /opt/jdk1.6.0_10_x64/bin/jdb 55
/usr/sbin/update-alternatives --install /usr/bin/jhat jhat /opt/jdk1.6.0_10_x64/bin/jhat 55
/usr/sbin/update-alternatives --install /usr/bin/jinfo jinfo /opt/jdk1.6.0_10_x64/bin/jinfo 55
/usr/sbin/update-alternatives --install /usr/bin/jmap jmap /opt/jdk1.6.0_10_x64/bin/jmap 55
/usr/sbin/update-alternatives --install /usr/bin/jps jps /opt/jdk1.6.0_10_x64/bin/jps 55
/usr/sbin/update-alternatives --install /usr/bin/jrunscript jrunscript /opt/jdk1.6.0_10_x64/bin/jrunscript 55
/usr/sbin/update-alternatives --install /usr/bin/jsadebugd jsadebugd /opt/jdk1.6.0_10_x64/bin/jsadebugd 55
/usr/sbin/update-alternatives --install /usr/bin/jstack jstack /opt/jdk1.6.0_10_x64/bin/jstack 55
/usr/sbin/update-alternatives --install /usr/bin/jstat jstat /opt/jdk1.6.0_10_x64/bin/jstat 55
/usr/sbin/update-alternatives --install /usr/bin/jstatd jstatd /opt/jdk1.6.0_10_x64/bin/jstatd 55
/usr/sbin/update-alternatives --install /usr/bin/jvisualvm jvisualvm /opt/jdk1.6.0_10_x64/jvisualvm
/usr/sbin/update-alternatives --install /usr/bin/keytool keytool /opt/jdk1.6.0_10_x64/bin/keytool 55
/usr/sbin/update-alternatives --install /usr/bin/native2ascii native2ascii /opt/jdk1.6.0_10_x64/bin/native2ascii 55
/usr/sbin/update-alternatives --install /usr/bin/orbd orbd /opt/jdk1.6.0_10_x64/bin/orbd 55
/usr/sbin/update-alternatives --install /usr/bin/pack200 pack200 /opt/jdk1.6.0_10_x64/bin/pack200 55
/usr/sbin/update-alternatives --install /usr/bin/policytool policytool /opt/jdk1.6.0_10_x64/bin/policytool 55
/usr/sbin/update-alternatives --install /usr/bin/rmic rmic /opt/jdk1.6.0_10_x64/bin/rmic 55
/usr/sbin/update-alternatives --install /usr/bin/rmid rmid /opt/jdk1.6.0_10_x64/bin/rmid 55
/usr/sbin/update-alternatives --install /usr/bin/rmiregistry rmiregistry /opt/jdk1.6.0_10_x64/bin/rmiregistry 55
/usr/sbin/update-alternatives --install /usr/bin/schemagen schemagen /opt/jdk1.6.0_10_x64/bin/schemagen 55
/usr/sbin/update-alternatives --install /usr/bin/serialver serialver /opt/jdk1.6.0_10_x64/bin/serialver 55
/usr/sbin/update-alternatives --install /usr/bin/servertool servertool /opt/jdk1.6.0_10_x64/bin/servertool 55
/usr/sbin/update-alternatives --install /usr/bin/tnameserv tnameserv /opt/jdk1.6.0_10_x64/bin/tnameserv 55
/usr/sbin/update-alternatives --install /usr/bin/unpack200 unpack200 /opt/jdk1.6.0_10_x64/bin/unpack200 55
/usr/sbin/update-alternatives --install /usr/bin/wsgen wsgen /opt/jdk1.6.0_10_x64/bin/wsgen 55
/usr/sbin/update-alternatives --install /usr/bin/wsimport wsimport /opt/jdk1.6.0_10_x64/bin/wsimport 55
/usr/sbin/update-alternatives --install /usr/bin/xjc xjc /opt/jdk1.6.0_10_x64/bin/xjc 55
 
Old 12-03-2008, 12:05 PM   #5
Setya
Member
 
Registered: Apr 2007
Posts: 41

Original Poster
Rep: Reputation: 15
Hi,

Thank you very much for your script. I really appreciate it.

Frankly, I don't see any substantial difference between the command I've invoked with the ones in your script.

The problem is Xubuntu is still unable to find java despite the link created by update-alternatives in /usr/bin/java so I don't think your script is going to make any difference.


Regards,

Setya
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Script cd not work as expected cdcshu Linux - Software 1 11-10-2007 04:38 AM
iptables rules doesn't work as expected.. Shioni Linux - Security 4 11-15-2006 01:37 AM
how does file dependencies work with symbolic linking? bulletck Linux - Newbie 1 12-23-2005 09:22 PM
If your hardware does not work as expected! Keruskerfuerst Suse/Novell 1 11-06-2005 05:43 AM
-ne argument expected WHY doesnt this work VisionZ Linux - Newbie 8 03-27-2004 12:39 AM


All times are GMT -5. The time now is 10:41 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration