Script to install jdk


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script to install jdk
# 1  
Old 05-09-2008
Script to install jdk

Hi,

I need a shell script that would do silent installation of jdk on a linux machine.

Can anyone help me with this?

Thanx
Sunny

Last edited by eamani_sun; 06-12-2008 at 09:48 PM..
# 2  
Old 05-09-2008
This task is not difficult, you would normally install jdk on linux by doing something like:

./jdk-installer-bin

It'll prompt for you to accept the EULA which just requires "y" along with accepting other defaults.

I would go through the manual process and figure out if you want to use the defaults, come up with an answer file which is just the answer to each question with a newline separating.

Then have a script just do the following:

Code:
#!/bin/sh

./jdk-installer-bin < answer_file

This will provide you with an auto-answer to the installer, I mean you would probably want to check if there's a version that exists/etc. but that's the basic script if you wanted an automated/silent installer.
# 3  
Old 05-09-2008
Thanks for the reply.

But, I have one more question though,the jdk file I am installing has a 'More' command inside it just before the agreement instructions, that way they are making sure that everyone reads the entire agreement.

is there anyway that i can avoid it. I tried to manipulate the file by removing the "more" command from the script. But ,when I reexecute it would say file has been corrupted.

Is there any other way around?

Thanks in advance.

Sundeep
# 4  
Old 05-09-2008
Last time I checked, it's a general user agreement, once you page down it'll ask if you want to accept. If you pass in "y\n" it should page through that portion. I haven't done an installation lately, but I would suggest looking at passing in some return keys or something that would force the page down.
# 5  
Old 05-12-2008
I have tried that too, I have passed in some returns in the answer file, but it is not taking them as input to scroll down, instead it is accepting them at the eula agreement form.

I dont want user to give any kind of input for scrolling down.

Any kind of help would be great

Thanks in advance.

Sundeep
# 6  
Old 05-12-2008
Which JDK are you trying to install, do you have the version you're trying to automate the install? I can try it on my dev box and see what I come up with
# 7  
Old 12-06-2008
Tips to launch a silent install

Here's a tips I found trying to do the same as you :
1. Create an answers.txt file with the word y inside
2. Launch fhe following command (assuming you want to install jdk-xx.bin)
./jdk-xx.bin < answers.txt &>/dev/null

The install goes on slient.

Could you tell me if it works also for you ? (Just to be sure that this is not limited to my linux version).

Note : if you want to check if something went wrong you can echo $? (result of the install)
echo $? => 0 (ok)
echo $? => 1 (problem)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Fedora

Fedora: Uninstall Java JDK 1.8 and install Oracle Java 1.7.15

Hi All, I have just downloaded fedora 27 iso and set it up in virtual box. I want to learn Hadoop so trying to install Apache hadoop. Before all those I have to install Oracle Java 1.7.15 (as mentioned in the Apache hadoop page). Can you please help me how to Uninstall currently installed... (6 Replies)
Discussion started by: TechGyaann
6 Replies

2. HP-UX

jdk

How can i see if jdk is installed or not on my system. I am on HP UX B.11.31 (3 Replies)
Discussion started by: bang_dba
3 Replies

3. Solaris

How to install java (jdk-74) on solaris 10?

What kind of required java type for installed? which address link, i need to download the package. i have zcat this version jdk-7-solaris-sparc.tar.Z and then installed each the packages with pkgadd -d . , but my java version still java full version "1.5.0_24-b02".is it need doanything after... (1 Reply)
Discussion started by: aagusman
1 Replies

4. Ubuntu

JDK path

Hello, I have installed the default JDK from Software centre, but when i type whereis JDK on the terminal.. i don't see any path :mad: i need JDk to install a tool ... Hurry!!! please HELP:confused::confused: (4 Replies)
Discussion started by: paramad
4 Replies

5. Shell Programming and Scripting

how to Install jdk.bin using shell script with auto yes/no?

#!/bin/sh echo "Installing Java!!!" cd /opt echo "Want to give execute Permissions to java!!!" chmod 755 jdk-6u7-linux-i586.bin echo "Executing the jdk script" ./jdk-6u7-linux-i586.bin This is the shell commands I am using... I want to know how to give answer to yes and no automatically... (6 Replies)
Discussion started by: sandeepbharmori
6 Replies

6. Shell Programming and Scripting

How to install jdk 6u17 in a prompt-less script

I came across this site while Googling for how to silently install JDK 6u17. I didn't find a solution, but I came up with this hack so I thought I'd post it here: The trick is to just temporarily disable the "more" application: ]# chmod u+x jdk-6u17-linux-x64-rpm.bin ]# # Prevent prompts...... (0 Replies)
Discussion started by: mhart
0 Replies

7. Shell Programming and Scripting

How to Upgrade Jdk After install in linux

hii... i want to upgrade my java version 1.4.2 to 1.6 in linux plateform after installing JDK. so what are the steps & commands in linux to upgrade it . Please Help me ... (1 Reply)
Discussion started by: rinkugarg
1 Replies

8. UNIX for Dummies Questions & Answers

Download & install JDK 1.6

Hi.. I want to download & install JDK 1.6 for linux so please help me where i can downlod it free Regards Rinku Garg (1 Reply)
Discussion started by: rinkugarg
1 Replies

9. Solaris

error during install jdk 5.0.11 packages

hi all i tried to install jdk on solaris 10 2008 and i used these packages in installation pkgadd -d SUNWj5cfg SUNWj5dmo SUNWj5dev SUNWj5rt SUNWj5jmp SUNWj5man all was good except one (SUNWj5rt) some of the output ERROR: attribute verification of... (3 Replies)
Discussion started by: maxim42
3 Replies

10. UNIX for Dummies Questions & Answers

Question about install JDK on SCO Unix

I try to run java file on SCO Unix, but my Unix doesn't setup with JDK environment. I go to sun.com to download JDK for SCO Unix, but there is only JDK for HP-UNIX, is it ok for SCO Unix? If it's ok, how can I install it to my Unix after I download? If it's not ok, How can I do to run java file in... (0 Replies)
Discussion started by: wendyz
0 Replies
Login or Register to Ask a Question