LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   shell script : finding out active configuration of java jdk and install bin there. (https://www.linuxquestions.org/questions/programming-9/shell-script-finding-out-active-configuration-of-java-jdk-and-install-bin-there-4175468115/)

rohaanembedded 07-02-2013 02:36 AM

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.

please help me in this please

Thanks & Regards
rohaan

evo2 07-02-2013 03:21 AM

Hi,

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.

rohaanembedded 07-02-2013 03:34 AM

Quote:

Originally Posted by evo2 (Post 4982319)
Hi,

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

and Thanks again

Regards
rohhan

rohaanembedded 07-02-2013 04:35 AM

HelloOO

anyone please help me in this

regards
rohaan

rohaanembedded 07-02-2013 05:51 AM

Dear sir,

Code:

readlink -f $(which java)
gives output like
Code:

/usr/lib/jvm/java-6-openjdk/jre/bin/java
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
Code:

#!/bin/bash

readlink -f $(which java)


evo2 07-02-2013 07:30 PM

Hi,

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.

rohaanembedded 07-03-2013 12:25 AM

Quote:

Originally Posted by evo2 (Post 4982919)
Hi,

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

regards
rohaan

evo2 07-03-2013 12:39 AM

Hii,

Quote:

Originally Posted by rohaanembedded (Post 4983096)
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/.

Cheers,

Evo2.

rohaanembedded 07-03-2013 12:55 AM

Quote:

Originally Posted by evo2 (Post 4983107)
Hii,


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/.

Cheers,

Evo2.

dear sir,
ohh thanks i wil try thing also

regards
rohan

rohaanembedded 07-03-2013 01:10 AM

Quote:

Originally Posted by rohaanembedded (Post 4983120)
dear sir,
ohh thanks i wil try thing also

regards
rohan

Dear sir,

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

Regards
rohaan

evo2 07-03-2013 01:20 AM

Hi,

don't use the .jar or .bin files, instead download and use the .deb file from the Ubuntu repository.
See for example http://packages.ubuntu.com/search?keywords=libjai

Evo2.

rohaanembedded 07-03-2013 01:54 AM

Quote:

Originally Posted by evo2 (Post 4983138)
Hi,

don't use the .jar or .bin files, instead download and use the .deb file from the Ubuntu repository.
See for example http://packages.ubuntu.com/search?keywords=libjai

Evo2.

Dear sir

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

Thanking you

Rohaan

evo2 07-03-2013 02:30 AM

Hi,

did you check licence in regards to redistributing Sun/Oracle Java? I checked the FAQ https://www.java.com/en/download/faq/distribution.xml and it seems you are supposed to abide by the "Oracle Binary Code License" http://www.oracle.com/technetwork/ja...nse/index.html if redistributing their software.

Oracle is a pretty scary company.

Anyway, good luck.

Evo2.

rohaanembedded 07-03-2013 02:37 AM

Quote:

Originally Posted by evo2 (Post 4983192)
Hi,

did you check licence in regards to redistributing Sun/Oracle Java? I checked the FAQ https://www.java.com/en/download/faq/distribution.xml and it seems you are supposed to abide by the "Oracle Binary Code License" http://www.oracle.com/technetwork/ja...nse/index.html if redistributing their software.

Oracle is a pretty scary company.

Anyway, good luck.

Evo2.

Thanks for info.

but i am not using it as commercial thing not going to distribute also as commercial app or anything :)

regards
rohan


All times are GMT -5. The time now is 11:17 AM.