Chinaunix首页 | 论坛 | 博客
  • 博客访问: 346853
  • 博文数量: 38
  • 博客积分: 1289
  • 博客等级: 中尉
  • 技术积分: 533
  • 用 户 组: 普通用户
  • 注册时间: 2008-06-10 22:30
个人简介

Good Good Study. Day Day Up.

文章分类

全部博文(38)

文章存档

2018年(1)

2016年(3)

2015年(12)

2014年(7)

2013年(10)

2012年(5)

分类: 系统运维

2014-09-10 12:39:09

操作系统版本:
E:\>systeminfo | findstr /c:"OS Name"
OS Name:                   Microsoft(R) Windows(R) Server 2003, Enterprise Edition

Java 版本:
E:\>java -version
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) Client VM (build 24.65-b04, mixed mode, sharing)

测试结果:
E:\>test.bat
Testing: -Xmx1000m OK
Testing: -Xmx1100m OK
Testing: -Xmx1200m OK
Testing: -Xmx1300m OK
Testing: -Xmx1400m OK
Testing: -Xmx1400m OK
Testing: -Xmx1410m OK
Testing: -Xmx1420m OK
Testing: -Xmx1430m OK
Testing: -Xmx1440m OK
Testing: -Xmx1440m OK
Final value is: -Xmx1440m
Press any key to continue . . .

代码:

点击(此处)折叠或打开

  1. @echo off
  2. REM ============================================================================
  3. REM Function: Fetch the max value of java option -Xmx in 32 bit Windows system
  4. REM Version: 1.0 @ Sep 10 2014
  5. REM ============================================================================

  6. java -version >nul 2>&1
  7. if errorlevel 1 (
  8.     echo Please make sure you have:
  9.     echo 1. Installed JDK or JRE
  10.     echo 2. Created environment variable %%JAVA_HOME%%
  11.     echo 3. Added environment variable %%JAVA_HOME%%\bin into %%PATH%%
  12.     goto End
  13. )

  14. :StepHundred
  15. for /l %%i in (1000,100,2048) do (
  16.     java -Xmx%%im -version >nul 2>&1
  17.     if errorlevel 1 (
  18.         goto StepTen
  19.     ) else (
  20.         set "Xmx=%%i"
  21.         echo Testing: -Xmx%%im OK
  22.     )
  23. )

  24. :StepTen
  25. for /l %%i in (%Xmx%,10,2048) do (
  26.     java -Xmx%%im -version >nul 2>&1
  27.     if errorlevel 1 (
  28.         goto StepOne
  29.     ) else (
  30.         set "Xmx=%%i"
  31.         echo Testing: -Xmx%%im OK
  32.     )
  33. )

  34. :StepOne
  35. for /l %%i in (%Xmx%,1,2048) do (
  36.     java -Xmx%%im -version >nul 2>&1
  37.     if errorlevel 1 (
  38.         goto ShowResult
  39.     ) else (
  40.         set "Xmx=%%i"
  41.         echo Testing: -Xmx%%im OK
  42.     )
  43. )

  44. :ShowResult
  45. echo Final value is: -Xmx%Xmx%m

  46. :End
  47. pause
阅读(3267) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~