[SOLVED] shell script : finding out active configuration of java jdk and install bin there.
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
shell script : finding out active configuration of java jdk and install bin there.
Dear sir,
i want to find out the active java configuration on ubuntu machine and go to that folder and install jai-1_1_3-lib-linux-i586-jdk.bin
i have tried script like,
Code:
#!/bin/bash
cd /usr/lib/jvm/java-*-openjdk/
cp /home/usb/jai/jai-1_1_3-lib-linux-i586-jdk.bin .
chmod 777 jai-1_1_3-lib-linux-i586-jdk.bin
./jai-1_1_3-lib-linux-i586-jdk.bin
but it doesnt really install the .bin in active Java JDK on machin
to find out the active configuration there is a command also
Code:
sudo update-alternatives --config java
which gives
Code:
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 auto mode
1 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 manual mode
2 /usr/lib/jvm/jdk1.7.0/bin/java 1 manual mode
Press enter to keep the current choice[*], or type selection number: 0
i dont want to change the active java JDK confg but just want to go to that folder and install my .bin there.
I don't recommend manually putting files under /usr/lib, but you can find the location of the default java with something quick and dirty like:
Code:
readlink -f $(which java)
Or using update alternatives:
Code:
update-alternatives --list java
Evo2.
Dear sir,
Thanks for your rply n time, really thanks
i am in need of installing the "jai-1_1_3-lib-linux-i586-jdk.bin" in to the active java JDK so i have to do this so that if i gave this script to some other PC the .bin should be installed on the their Active java JDK
please suggst me changes in my given script i am not that gud shell script writer please
how can use this path to go to the location in /usr/lib/jvm/java-6-openjdk/
how to catch the output of the above command while using it in shell script like
this is marked as solved now, and I wonder what your solution was. Did you learn how to set variables in a shell script?
Regardless I don't know why you are trying to manually dump that file in that particular location. If you want to install the java imaging api you should probably be using your package manager.
this is marked as solved now, and I wonder what your solution was. Did you learn how to set variables in a shell script?
Regardless I don't know why you are trying to manually dump that file in that particular location. If you want to install the java imaging api you should probably be using your package manager.
Eg
Code:
sudo apt-get install libjai-core-java
Evo2.
Dear sir
thanks for rply i find out how we can use that PATH getting from the readlink -f $(which java)
and used that path in my script and done with the thing
Actually i want it because as i told u i want to give this thing to the another users which may no have net or they should not have to do this apt-get bcz this has to be a part of my application which uses jai as library
thanks again really thanks
i not that gud at explaining then also u helped thnks
Dear sir
Actually i want it because as i told u i want to give this thing to the another users which may no have net or they should not have to do this apt-get bcz this has to be a part of my application which uses jai as library
Ok, then you can bundle the jai .deb file and have your script install it using "dpkg -i". Anything is better than just dumping the .bin file in is /usr/lib/.
Ok, then you can bundle the jai .deb file and have your script install it using "dpkg -i". Anything is better than just dumping the .bin file in is /usr/lib/.
i have the jai-1_1_3-lib-linux-i586-jdk.bin file dowloaded how can i make bundle this as .deb
and another one is i have two files
1) sun-jai_codec.jar
2) sun-jai_core.jar
how can i bundle it as .deb
Your perfectly right in approach but its size is around 5MB for each file libjai-core-java i have to give it with my package so i think it will be better to use this jai-1_1_3-lib-linux-i586-jdk.bin which includes all the functionality of two files sun-java_core.jar and sun-java_codec.jar and its size is also lesser around 3.5MB
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.