jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From milam...@apache.org
Subject svn commit: r1579552 - in /jmeter/trunk: bin/jmeter bin/jmeter.bat xdocs/changes.xml
Date Thu, 20 Mar 2014 07:42:42 GMT
Author: milamber
Date: Thu Mar 20 07:42:42 2014
New Revision: 1579552

URL: http://svn.apache.org/r1579552
Log:
Add the check of the Java's version in startup files and disable some options when is Java
v8 engine
Bugzilla Id: 56292

Modified:
    jmeter/trunk/bin/jmeter
    jmeter/trunk/bin/jmeter.bat
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/bin/jmeter
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/jmeter?rev=1579552&r1=1579551&r2=1579552&view=diff
==============================================================================
--- jmeter/trunk/bin/jmeter (original)
+++ jmeter/trunk/bin/jmeter Thu Mar 20 07:42:42 2014
@@ -21,6 +21,23 @@
 ##
 ##   ==============================================
 
+# Minimal version to run JMeter
+MINIMAL_VERSION=1.6.0
+
+# Check if Java is present and the minimal version requierement
+_java=`type java | awk '{ print $ NF }'`
+CURRENT_VERSION=$("$_java" -version 2>&1 | awk -F '"' '/version/ {print $2}')
+minimal_version=$(echo $MINIMAL_VERSION | awk -F'.' '{ print $2 }')
+current_version=$(echo $CURRENT_VERSION | awk -F'.' '{ print $2 }')
+if [ $current_version ]; then
+        if [ $current_version -lt $minimal_version ]; then
+                 echo "Error: Java version is too lower to run JMeter. Needs at least Java
>= ${MINIMAL_VERSION}." 
+                 exit 1
+        fi
+    else
+         echo "Not able to find Java executable or version. Please check your Java installation."
+         exit 1
+fi
 
 # The following should be reasonably good values for most tests running
 # on Sun JVMs. Following is the analysis on which it is based. If it's total
@@ -70,8 +87,13 @@ TENURING="-XX:MaxTenuringThreshold=2"
 # without having gone through a lot of Full GC-ing just before the OOM:
 # EVACUATION="-XX:MaxLiveObjectEvacuationRatio=20%"
 
-# Increase MaxPermSize if you use a lot of Javascript in your Test Plan :
-PERM="-XX:PermSize=64m -XX:MaxPermSize=128m -XX:+CMSClassUnloadingEnabled"
+# Java 8 remove Permanent generation, don't settings the PermSize
+if [ $current_version -lt "8" ]; then
+    # Increase MaxPermSize if you use a lot of Javascript in your Test Plan :
+    PERM="-XX:PermSize=64m -XX:MaxPermSize=128m"
+fi
+
+CLASS_UNLOAD="-XX:+CMSClassUnloadingEnabled"
 
 # Finally, some tracing to help in case things go astray:
 #DEBUG="-verbose:gc -XX:+PrintTenuringDistribution"
@@ -81,6 +103,6 @@ DUMP="-XX:+HeapDumpOnOutOfMemoryError"
 
 SERVER="-server"
 
-ARGS="$SERVER $DUMP $HEAP $NEW $SURVIVOR $TENURING $EVACUATION $PERM"
+ARGS="$SERVER $DUMP $HEAP $NEW $SURVIVOR $TENURING $EVACUATION $PERM $CLASS_UNLOAD"
 
 java $ARGS $JVM_ARGS -jar "`dirname "$0"`/ApacheJMeter.jar" "$@"

Modified: jmeter/trunk/bin/jmeter.bat
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/jmeter.bat?rev=1579552&r1=1579551&r2=1579552&view=diff
==============================================================================
--- jmeter/trunk/bin/jmeter.bat (original)
+++ jmeter/trunk/bin/jmeter.bat Thu Mar 20 07:42:42 2014
@@ -26,6 +26,40 @@ rem              this is used by the jme
 rem
 rem   =====================================================
 
+rem Minimal version to run JMeter
+set MINIMAL_VERSION=1.6.0
+
+for /f "tokens=3" %%g in ('java -version 2^>^&1 ^| findstr /i "version"') do (
+    rem @echo Debug Output: %%g
+    set JAVAVER=%%g
+)
+set JAVAVER=%JAVAVER:"=%
+if not defined JAVAVER (
+    @echo Not able to find Java executable or version. Please check your Java installation.
+    set ERRORLEVEL=2-NO_JAVA
+    goto pause
+)
+@echo 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-NO_JAVA
+    goto pause
+)
+rem @echo Debug: CURRENT=%current_minor% - MINIMAL=%minimal_minor%
+if %current_minor% LSS %minimal_minor% (
+    @echo Error: Java version is too lower to run JMeter. Needs at least Java greater or
equal to %MINIMAL_VERSION%
+    set ERRORLEVEL=3-JAVA_TOO_LOWER
+    goto pause
+)
+
 if .%JM_LAUNCH% == . set JM_LAUNCH=java.exe
 
 if not "%OS%"=="Windows_NT" goto win9xStart
@@ -74,7 +108,13 @@ 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
-set PERM=-XX:PermSize=64m -XX:MaxPermSize=128m -XX:+CMSClassUnloadingEnabled
+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)
@@ -95,7 +135,7 @@ rem set DDRAW=%DDRAW% -Dsun.java2d.ddsca
 
 rem Server mode
 rem Collect the settings defined above
-set ARGS=%DUMP% %HEAP% %NEW% %SURVIVOR% %TENURING% %PERM% %DDRAW%
+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%
 
@@ -111,3 +151,4 @@ echo errorlevel=%ERRORLEVEL%
 pause
 
 :end
+

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1579552&r1=1579551&r2=1579552&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Thu Mar 20 07:42:42 2014
@@ -210,6 +210,7 @@ A workaround is to use a Java 7 update 4
 <h3>General</h3>
 <ul>
 <li><bugzilla>21695</bugzilla> - Unix jmeter start script assumes it is
on PATH, not a link</li>
+<li><bugzilla>56292</bugzilla> - Add the check of the Java's version in
startup files and disable some options when is Java v8 engine</li>
 </ul>
 
 <ch_section>Non-functional changes</ch_section>



Mime
View raw message