Friday, April 08, 2016

How to force java path in subscript (nested script call)

If you use a script that runs another script which starts a java virtual machine, you should need to specify which java command you want to use from the first script. Consider the following example :

startup.sh  --->  application.sh --> java command

I can modify startup.sh but not application.sh which calls java command. But I need a specify version a java.

So, I tried to solve this problem with :

  • linux 'source' command ... BAD!!!
  • linux 'alias' command... BAD!!!
But, I finally got a working solution by redefining a  'java' function before calling application.sh. GOT IT! When application.sh calls 'java', it invokes my function. Like this :


java() {
    /specificpath/jdk/bin/java "$@"
}
export -f java
sh ./application.sh


Enjoy!

4 comments:

simashree said...

Thanks for the great information in your blog Selenium Training in Chennai

seoindiarank chennai said...

Very nice post here thanks for it .I always like and such a super contents of these
post.Excellent and very cool idea and great content of different kinds of the valuable
information's. seo company in chennai

Webtrackker Noida said...

Webtrackker technology is the best IT training institute in NCR. Webtrackker provide training on all latest technology such as java training. Webtrackker is not only training institute but also it also provide best IT solution to his client. Webtrackker provide training by experienced and working in the industry on same technology.Webtrackker Technology C-67 Sector-63 Noida 8802820025

Java Training institute in indirapuram


Java training institute in Noida


Java training institute in Ghaziabad


java training institute in Vaishali


Java Training institute in Vasundhara


Java Training institute in Delhi South Ex

Sujit kUmar said...

nice post for sharing Java article. its really helpful for me. keep shring on updated tutorials????????????????