makeufun 发表于 2016-7-23 23:50:23

求助,Jmeter在jdk安装后不能运行,跟环境变量没有关系

本帖最后由 makeufun 于 2016-7-30 14:10 编辑

系统是win7 32位系统
安装版本为:jdk-8u51-windows-i586.exe
                     jmeter3.0

第一次安装不成功,提示下图:


把java用电脑管家卸载,jmeter解压包删除,环境变量的设置也全部删掉重新按步骤安装,安装完成和配置好环境变量后,提示如下

这是什么问题?怎样解决?本人是小白,第一次装,重装了N遍都搞不定,度娘上没有这个相关的问题,求大神来解答一下:'(



经过一个礼拜的各种度娘还是搞不定,通过朋友的朋友---一名程序猿帮忙搞定了,十分感谢他的帮忙。
自己总结一下,希望也能帮到遇到同样问题的人。
1、查出错原因,以管理员身份运行jmeter.bat这个文件,看提示什么错误,我的提示如下

说明java -version 2^>^&1 ^| findstr /i "version这个命令执行不了
然后用记事本打开jmeter.bat,在图片中的位置加上Set JAVAVER=“1.8.0_91”,保存再以管理员身份运行jmeter.bat就可以打开了


“1.8.0_91”关于这个版本号,是在另外一台已装了jmeter的电脑上面查的,具体步骤是:
用记事本打开jmeter.bat
,在set JAVAVER=%%g前面加一句echo JAVAVER=%%g,保存关闭再以管理员身份运行可以得到

目前已有文章根本没有遇到这个问题的,看来我也是个奇葩,这么冷门的问题都被我遇上了



jingzizx 发表于 2016-7-24 10:14:15

这个文件没损坏?打开看看

makeufun 发表于 2016-7-24 14:42:10

jingzizx 发表于 2016-7-24 10:14
这个文件没损坏?打开看看

没有损坏的,在另外一台电脑64位的,装了64位的jdk用同一个包安装成功了,所以不知道是什么问题,这个jmeter是需要java7以上才能装,这个版本应该是8的吧

makeufun 发表于 2016-7-24 14:43:22

jingzizx 发表于 2016-7-24 10:14
这个文件没损坏?打开看看

用记事本打开之后是这样的,看不懂


@echo off

rem   Licensed to the Apache Software Foundation (ASF) under one or more
rem   contributor license agreements.See the NOTICE file distributed with
rem   this work for additional information regarding copyright ownership.
rem   The ASF licenses this file to You under the Apache License, Version 2.0
rem   (the "License"); you may not use this file except in compliance with
rem   the License.You may obtain a copy of the License at
rem
rem       http://www.apache.org/licenses/LICENSE-2.0
rem
rem   Unless required by applicable law or agreed to in writing, software
rem   distributed under the License is distributed on an "AS IS" BASIS,
rem   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem   See the License for the specific language governing permissions and
rem   limitations under the License.

rem   =====================================================
rem   Environment variables that can be defined externally:
rem
rem   JMETER_BIN - JMeter bin directory (must end in \)
rem   JM_LAUNCH - java.exe (default) or javaw.exe
rem   JVM_ARGS - additional java options, e.g. -Dprop=val
rem   JM_START - set this to "start" to launch JMeter in a separate window
rem            this is used by the jmeterw.cmd script.
rem
rem   =====================================================

setlocal

rem Minimal version to run JMeter
set MINIMAL_VERSION=1.7.0

for /f "tokens=3" %%g in ('java -version 2^>^&1 ^| findstr /i "version"') do (
    rem @echo Debug Output: %%g
    set JAVAVER=%%g
)
if not defined JAVAVER (
    @echo Not able to find Java executable or version. Please check your Java installation.
    set ERRORLEVEL=2
    goto pause
)
set JAVAVER=%JAVAVER:"=%
for /f "delims=. tokens=1-3" %%v in ("%JAVAVER%") do (
    set current_minor=%%w
)

for /f "delims=. tokens=1-3" %%v in ("%MINIMAL_VERSION%") do (
    set minimal_minor=%%w
)

if not defined current_minor (
    @echo Not able to find Java executable or version. Please check your Java installation.
    set ERRORLEVEL=2
    goto pause
)
rem @echo Debug: CURRENT=%current_minor% - MINIMAL=%minimal_minor%
if %current_minor% LSS %minimal_minor% (
    @echo Error: Java version -- %JAVAVER% -- is too low to run JMeter. Needs a Java version greater than or equal to %MINIMAL_VERSION%
    set ERRORLEVEL=3
    goto pause
)

if .%JM_LAUNCH% == . set JM_LAUNCH=java.exe

if exist jmeter.bat goto winNT1
if .%JMETER_BIN% == . set JMETER_BIN=%~dp0

:winNT1
rem On NT/2K grab all arguments at once
set JMETER_CMD_LINE_ARGS=%*

rem The following link describes the -XX options:
rem http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html
rem http://java.sun.com/developer/TechTips/2000/tt1222.html has some more descriptions
rem Unfortunately TechTips no longer seem to be available, except via:
rem https://web.archive.org/web/20090614101951/http://java.sun.com/developer/TechTips/2000/tt1222.html

rem See the unix startup file for the rationale of the following parameters,
rem including some tuning recommendations
set HEAP=-Xms512m -Xmx512m
set NEW=-XX:NewSize=128m -XX:MaxNewSize=128m
set SURVIVOR=-XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=50%
set TENURING=-XX:MaxTenuringThreshold=2
rem Java 8 remove Permanent generation, don't settings the PermSize
if %current_minor% LEQ "8" (
    rem Increase MaxPermSize if you use a lot of Javascript in your Test Plan :
    set PERM=-XX:PermSize=64m -XX:MaxPermSize=128m
)

set CLASS_UNLOAD=-XX:+CMSClassUnloadingEnabled
rem set DEBUG=-verbose:gc -XX:+PrintTenuringDistribution

rem Always dump on OOM (does not cost anything unless triggered)
set DUMP=-XX:+HeapDumpOnOutOfMemoryError

rem Additional settings that might help improve GUI performance on some platforms
rem See: http://java.sun.com/products/java-media/2D/perf_graphics.html

set DDRAW=
remSetting this flag to true turns off DirectDraw usage, which sometimes helps to get rid of a lot of rendering problems on Win32.
rem set DDRAW=%DDRAW% -Dsun.java2d.noddraw=true

remSetting this flag to false turns off DirectDraw offscreen surfaces acceleration by forcing all createVolatileImage calls to become createImage calls, and disables hidden acceleration performed on surfaces created with createImage .
rem set DDRAW=%DDRAW% -Dsun.java2d.ddoffscreen=false

rem Setting this flag to true enables hardware-accelerated scaling.
rem set DDRAW=%DDRAW% -Dsun.java2d.ddscale=true

rem Server mode
rem Collect the settings defined above
set ARGS=%DUMP% %HEAP% %NEW% %SURVIVOR% %TENURING% %PERM% %CLASS_UNLOAD% %DDRAW%

%JM_START% %JM_LAUNCH% %ARGS% %JVM_ARGS% -jar "%JMETER_BIN%ApacheJMeter.jar" %JMETER_CMD_LINE_ARGS%

rem If the errorlevel is not zero, then display it and pause

if NOT errorlevel 0 goto pause
if errorlevel 1 goto pause

goto end

:pause
echo errorlevel=%ERRORLEVEL%
pause

:end

seagull1985 发表于 2016-7-25 09:46:43

你是不是没配置jmeter的全局环境变量?

makeufun 发表于 2016-7-25 11:24:14

seagull1985 发表于 2016-7-25 09:46
你是不是没配置jmeter的全局环境变量?

设了这个“JMETER_HOME”,和改了CLASSPATH的变量值

seagull1985 发表于 2016-7-25 12:02:24

makeufun 发表于 2016-7-25 11:24
设了这个“JMETER_HOME”,和改了CLASSPATH的变量值

再检查下有没有设置错。。。感觉是环境变量的问题

漂小若 发表于 2016-7-27 11:25:52

JMeter启动时cmd窗口报错“出现'findstr' 不是内部或外部命令,也不是可运行的程序或批处理文件”
我也遇到了这个问题


是因为Path环境变量没配好。
解决办法:将“%SystemRoot%/system32;%SystemRoot%;”加入path变量,然后再次启动JMeter成功

漂小若 发表于 2016-7-27 11:27:37

JMeter启动时cmd窗口报错“出现'findstr' 不是内部或外部命令,也不是可运行的程序或批处理文件”
我也遇到了这个问题。


原因是Path环境变量没配好。
解决办法:将“%SystemRoot%/system32;%SystemRoot%;”加入path变量,再次启动JMeter成功。

makeufun 发表于 2016-7-29 15:31:43

漂小若 发表于 2016-7-27 11:27
JMeter启动时cmd窗口报错“出现'findstr' 不是内部或外部命令,也不是可运行的程序或批处理文件”
我也遇 ...

这个设置试过了,不行,现在卸载重装了之后,一直提示Windows找不到该文件

makeufun 发表于 2016-7-29 15:31:50

漂小若 发表于 2016-7-27 11:27
JMeter启动时cmd窗口报错“出现'findstr' 不是内部或外部命令,也不是可运行的程序或批处理文件”
我也遇 ...

这个设置试过了,不行,现在卸载重装了之后,一直提示Windows找不到该文件
页: [1]
查看完整版本: 求助,Jmeter在jdk安装后不能运行,跟环境变量没有关系