EAP 602: scripting problems

Questions about YourKit Java Profiler
Post Reply
mschulz
Posts: 17
Joined: Mon May 16, 2005 8:40 pm

EAP 602: scripting problems

Post by mschulz »

Hi,

I have a couple of suggestions to improve you Unix scripts:

1) yjp.sh

If YJP_JAVA_HOME is not set, the result is to pick up /bin/java.
That's not good enough (since I have JAVA_HOME set).
So please test "$YJP_JAVA_HOME" != "":
if [ "$YJP_JAVA_HOME" != "" ] ; then
JAVA_EXE=$YJP_JAVA_HOME/bin/java
fi

2) Tomcat, the modified startup_with_yjp.sh script:
Since you elect to expand YJP to 'YourKit Java Profiler 4.5 EAP build 602.app',
that will require quotes in all places which set shell variables:

_YH_="/tmp/YourKit Java Profiler 4.5 EAP build 602.app"
and subsequently in all places where _YH_ is being used.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Post by Anton Katilin »

1) yjp.sh

If YJP_JAVA_HOME is not set, the result is to pick up /bin/java.
That's not good enough (since I have JAVA_HOME set).
So please test "$YJP_JAVA_HOME" != "":
if [ "$YJP_JAVA_HOME" != "" ] ; then
JAVA_EXE=$YJP_JAVA_HOME/bin/java
fi
I'm sorry, I'm afraid I do not understand what's wrong.

The script yjp.sh actually probes YJP_JAVA_HOME, then JAVA_HOME, and only then java in PATH.

So if you have JAVA_HOME specified, it should be used.

2) Tomcat, the modified startup_with_yjp.sh script:
Since you elect to expand YJP to 'YourKit Java Profiler 4.5 EAP build 602.app',
that will require quotes in all places which set shell variables:

_YH_="/tmp/YourKit Java Profiler 4.5 EAP build 602.app"
and subsequently in all places where _YH_ is being used.
Corrected in 606, thank you.
mschulz
Posts: 17
Joined: Mon May 16, 2005 8:40 pm

Post by mschulz »

I have YJP_JAVA_HOME _not_ defined.

Hence, the script probes /bin/java,
which happens to exist, but it is not the desired one.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Post by Anton Katilin »

If you have YJP_JAVA_HOME not defined, but JAVA_HOME defined, it will take JAVA_HOME. Isn't it what you desire?
mschulz
Posts: 17
Joined: Mon May 16, 2005 8:40 pm

Post by mschulz »

The difference is with the program sitting there as /bin/java.

If you don't have that, everything is fine. But then try:

cat > /bin/java
#!/bin/sh
echo "Gotcha!"
^D
chmod 755 /bin/java.

Then try again yjp.sh
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Post by Anton Katilin »

Now I see the problem, thanks a lot!

Build 606 will contain a fix.
Post Reply