yjp.bat

Questions about YourKit Java Profiler
Post Reply
rblasch
Posts: 64
Joined: Mon Jan 10, 2005 7:13 pm

yjp.bat

Post by rblasch »

Here's a small batch file for Windows to start yjp, loosely based on yjp.sh.

Put it into %YJP_HOME%\bin. Consider setting the YJP_HOME and YJP_JAVA_HOME environment variables.

Ron

Code: Select all

@echo off

:: ------------------------------------------------------------------------------
:: YourKit Java Profiler startup script
:: ------------------------------------------------------------------------------

:: get the HOME directories
IF "%YJP_JAVA_HOME%" == "" SET YJP_JAVA_HOME=%JAVA_HOME%
IF "%YJP_JAVA_HOME%" == "" GOTO error_java_not_found

IF "%YJP_HOME%" == "" SET YJP_HOME=..


:: lookup executables and options
IF "%YJP_JAVA_EXE%" == "" SET YJP_JAVA_EXE=%YJP_JAVA_HOME%\jre\bin\javaw.exe
IF NOT EXIST "%YJP_JAVA_EXE%" GOTO error_java_not_found

SET YJP_JAR=%YJP_HOME%\lib\yjp.jar
IF NOT EXIST "%YJP_JAR%" GOTO error_yjp_not_found

SET YJP_INI=%YJP_HOME%\bin\win32\yjp.ini
IF NOT EXIST "%YJP_INI%" GOTO error_yjp_not_found
FOR /F "tokens=1,2* delims==" %%i IN (%YJP_INI%) DO SET YJP_%%i=%%j


:: start YJP
START "Yourkit Java Profiler" /B "%YJP_JAVA_EXE%" %YJP_VMARGS% -jar "%YJP_JAR%" %*

goto end


:error_java_not_found
echo Cannot start YourKit Java Profiler.
echo Please launch yjp.bat with {YourKit Java Profiler Home}\bin as working directory.
GOTO end

:error_yjp_not_found
echo To run YourKit Java Profiler Java 5.0 should be available.
echo Please make sure you have 'java' in your current PATH.
echo or set YJP_JAVA_HOME or JAVA_HOME environment variable to Java installation directory.
GOTO end

:end
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Post by Anton Katilin »

I'm sorry, I'm afraid I don't understand your intention.

Do you offer to start the profiler via .bat instead of .exe? If so, why?

Best regards,
Anton
rblasch
Posts: 64
Joined: Mon Jan 10, 2005 7:13 pm

Post by rblasch »

I'm sorry, I'm afraid I don't understand your intention.

Do you offer to start the profiler via .bat instead of .exe? If so, why?
Yes, this is an alternative to the .exe. It is mainly in preparation for my AMD64 box. I have 4 JDKs installed (JDK 1.3 x86-32, JDK 5.0 x86-32, JDK 5.0 x86-64, JDK 6.0 x86-64), and no idea how yjp.exe figures out which one it uses, and how the JVM is loaded. You know, 32-bit and 64-bit code doesn't mix on AMD64, so yjp.exe would not be able to load a 64-bit jvm.dll.

Consider this batch for the Paranoid Control Freak users. :shock:

Just thought I post it here, in case anyone else finds it useful. I'm sorry if this is off-topic.

Ron
Post Reply