LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-02-2013, 02:36 AM   #1
rohaanembedded
Member
 
Registered: May 2013
Location: India
Distribution: Ubuntu 11.10
Posts: 178

Rep: Reputation: Disabled
Question 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
 
Old 07-02-2013, 03:21 AM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
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.
 
1 members found this post helpful.
Old 07-02-2013, 03:34 AM   #3
rohaanembedded
Member
 
Registered: May 2013
Location: India
Distribution: Ubuntu 11.10
Posts: 178

Original Poster
Rep: Reputation: Disabled
Unhappy

Quote:
Originally Posted by evo2 View Post
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
 
Old 07-02-2013, 04:35 AM   #4
rohaanembedded
Member
 
Registered: May 2013
Location: India
Distribution: Ubuntu 11.10
Posts: 178

Original Poster
Rep: Reputation: Disabled
HelloOO

anyone please help me in this

regards
rohaan
 
Old 07-02-2013, 05:51 AM   #5
rohaanembedded
Member
 
Registered: May 2013
Location: India
Distribution: Ubuntu 11.10
Posts: 178

Original Poster
Rep: Reputation: Disabled
Unhappy

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)
 
Old 07-02-2013, 07:30 PM   #6
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
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.
 
Old 07-03-2013, 12:25 AM   #7
rohaanembedded
Member
 
Registered: May 2013
Location: India
Distribution: Ubuntu 11.10
Posts: 178

Original Poster
Rep: Reputation: Disabled
Smile

Quote:
Originally Posted by evo2 View Post
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
 
Old 07-03-2013, 12:39 AM   #8
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hii,

Quote:
Originally Posted by rohaanembedded View Post
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.
 
1 members found this post helpful.
Old 07-03-2013, 12:55 AM   #9
rohaanembedded
Member
 
Registered: May 2013
Location: India
Distribution: Ubuntu 11.10
Posts: 178

Original Poster
Rep: Reputation: Disabled
Smile

Quote:
Originally Posted by evo2 View Post
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
 
Old 07-03-2013, 01:10 AM   #10
rohaanembedded
Member
 
Registered: May 2013
Location: India
Distribution: Ubuntu 11.10
Posts: 178

Original Poster
Rep: Reputation: Disabled
Question

Quote:
Originally Posted by rohaanembedded View Post
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
 
Old 07-03-2013, 01:20 AM   #11
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
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.
 
1 members found this post helpful.
Old 07-03-2013, 01:54 AM   #12
rohaanembedded
Member
 
Registered: May 2013
Location: India
Distribution: Ubuntu 11.10
Posts: 178

Original Poster
Rep: Reputation: Disabled
Smile

Quote:
Originally Posted by evo2 View Post
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
 
Old 07-03-2013, 02:30 AM   #13
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
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.
 
1 members found this post helpful.
Old 07-03-2013, 02:37 AM   #14
rohaanembedded
Member
 
Registered: May 2013
Location: India
Distribution: Ubuntu 11.10
Posts: 178

Original Poster
Rep: Reputation: Disabled
Smile

Quote:
Originally Posted by evo2 View Post
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
 
  


Reply



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
[SOLVED] why cannot I install jdk-6u26-linux-i586-rpm.bin on slackware? yangzhichina Slackware 13 07-05-2011 09:07 AM
failing to install jdk-6u22-linux-i586.bin kenoo Linux - Desktop 3 10-16-2010 06:51 AM
i can't seem to install jdk 1.5.bin jadewarrior Ubuntu 2 09-28-2006 05:29 PM
Would like to install jdk 1.5 bin jadewarrior Red Hat 2 06-29-2006 02:48 AM
java .bin installation not finding JVM glassfrog Linux - Software 3 03-15-2006 04:50 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:53 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration