Bug 62128 - JMETER_HOME not set correctly in jmeter.bat
Summary: JMETER_HOME not set correctly in jmeter.bat
Status: CLOSED FIXED
Alias: None
Product: JMeter
Classification: Unclassified
Component: Main (show other bugs)
Version: 4.0
Hardware: All All
: P2 normal (vote)
Target Milestone: JMETER_5.0
Assignee: JMeter issues mailing list
URL:
Keywords: FixedInTrunk
Depends on:
Blocks:
 
Reported: 2018-02-23 07:33 UTC by logox01
Modified: 2018-03-31 11:48 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description logox01 2018-02-23 07:33:36 UTC
Hi,

I'm very happy about the change to define the user specific settings in a separate setenv.bat (no need to change the jmeter.bat anymore).

But currently I do need to update the jmeter.bat as well, because the JMETER_HOME directory does not point to the jmeter directory.
That happens if you don't start the jmeter.bat directly, but from another location (we use separate startup batch files within the testplan directory to define testplan specific parameters).

It would be great if you could define another fallback for setting the correct JMETER_HOME direcotry:

rem Guess JMETER_HOME if not defined
set "CURRENT_DIR=%cd%"
if not "%JMETER_HOME%" == "" goto gotHome
set "JMETER_HOME=%CURRENT_DIR%"
if exist "%JMETER_HOME%\bin\jmeter.bat" goto okHome
cd ..
set "JMETER_HOME=%cd%"
cd "%CURRENT_DIR%"
if exist "%JMETER_HOME%\bin\jmeter.bat" goto okHome
set JMETER_HOME=%~dp0\..
:gotHome

Thank you
Comment 1 Felix Schumacher 2018-02-24 09:59:28 UTC
Thanks for your contribution. This will be included in v4.1

It would be nice, if you could verify, that this fixes your problems.

Date: Sat Feb 24 09:57:38 2018
New Revision: 1825203

URL: http://svn.apache.org/viewvc?rev=1825203&view=rev
Log:
Try to guess JMETER_HOME correctly, when jmeter.bat is called from a batch file in another directory.

Contributed by logox01 (logox01 at gmx.at)

Bugzilla Id: 62128

Modified:
    jmeter/trunk/bin/jmeter.bat
    jmeter/trunk/xdocs/changes.xml
Comment 2 logox01 2018-02-26 08:37:22 UTC
I just tested the new jmeter.bat (r1825328).

This line:

set "%JMETER_HOME%=%~dp0\.."

needs to be replaced by that:

set "JMETER_HOME=%~dp0\.."

Best regards
Comment 3 Felix Schumacher 2018-02-26 17:25:43 UTC
Hopefully correct now. Thanks for the review.

Date: Mon Feb 26 17:23:57 2018
New Revision: 1825385

URL: http://svn.apache.org/viewvc?rev=1825385&view=rev
Log:
Set JMETER_HOME variable correctly.

Bugzilla Id: 62128

Modified:
    jmeter/trunk/bin/jmeter.bat
Comment 4 logox01 2018-02-27 10:58:27 UTC
Thanks for fixing the issue.
I successfully retested it with 4.1 r1825385.
Comment 5 Andrey Pokhilko 2018-03-27 14:47:24 UTC
IMO this issue is so critical that worth immediate minor release of JMeter...
Comment 6 Philippe Mouawad 2018-03-27 16:00:26 UTC
Hi Andrei,
What is so critical about it ?
I ‘ve tested jmeter 4.0 on windows and it didn’t hurt me that much.

but I may have missed something.

If we release a minor version, there is a risk if it’s nightly as we have hugely changed Http following removal of deprecated APIs and although we have been using it a lot in our team in scripting, we didn’t have yet the occasion to do a massive load test to ensure no issue appears.

Or maybe you’d like to only release this hotfix ?

Regards