Script to install jdk

install, linux, scrip, script, shell script, shell scripting, shell scripts, unix scripting, unix scripting basics

Thread Tools Search this Thread
# 1  
Old 05-09-2008
Script to install jdk


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

Can anyone help me with this?


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:


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:


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

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

# 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)

Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Fedora: Uninstall Java JDK 1.8 and install Oracle Java 1.7.15 TechGyaann Fedora 6 12-23-2017 12:59 AM
jdk bang_dba HP-UX 3 08-16-2012 11:28 PM
How to install java (jdk-74) on solaris 10? aagusman Solaris 1 06-16-2012 04:30 AM
Installing jdk sundaresh Programming 1 06-12-2011 02:50 AM
JDK path paramad Ubuntu 4 12-28-2010 07:07 AM
how to Install jdk.bin using shell script with auto yes/no? sandeepbharmori Shell Programming and Scripting 6 03-08-2010 09:15 AM
How to install jdk 6u17 in a prompt-less script mhart Shell Programming and Scripting 0 12-17-2009 12:19 PM
Jdk 1.6 Installtion saktiviji Solaris 2 12-09-2009 01:11 AM
How to Upgrade Jdk After install in linux rinkugarg Shell Programming and Scripting 1 08-13-2009 11:26 AM
Download & install JDK 1.6 rinkugarg UNIX for Dummies Questions & Answers 1 08-13-2009 07:58 AM
error during install jdk 5.0.11 packages maxim42 Solaris 3 06-21-2009 10:20 AM
jdk installation question k2k Red Hat 0 04-09-2009 10:32 AM
Question about install JDK on SCO Unix wendyz UNIX for Dummies Questions & Answers 0 12-05-2008 03:31 PM
JDK Installation idan_cn UNIX for Dummies Questions & Answers 0 07-05-2008 03:55 AM
find jdk 1.3.1 madmat UNIX for Dummies Questions & Answers 1 10-08-2007 02:05 PM