caojian1983 / jvmtop

Automatically exported from code.google.com/p/jvmtop
0 stars 0 forks source link

jvmtop.bat throws an exception when JAVA_HOME has spaces #60

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Before submitting a bug report, please check the FAQ:
http://code.google.com/p/jvmtop/wiki/FAQ

What steps will reproduce the problem?
1.Download latest jvmtop.tar.gz (0.8.0)
2.Unzip it go to the jvmtop-0.8.0 folder
3.Run jvmtop.bat
4.You should see the following error
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

What is the expected output? What do you see instead?

Expected:
 JvmTop 0.8.0 alpha - 10:19:24,  amd64,  4 cpus, Windows 8.1 6.3
 http://code.google.com/p/jvmtop

  PID MAIN-CLASS      HPCUR HPMAX NHCUR NHMAX    CPU     GC    VM USERNAME   #T DL
 6544 m.jvmtop.JvmTop   15m 1796m   13m   n/a 38.74%  0.00% O8U25   smore   18
14700                  104m  455m  204m   n/a  9.12%  0.00% O8U25   smore   31
15264                   69m  455m  167m   n/a  1.43%  0.00% O8U25   smore   27
10752 .bootstrap.Main   32m 1796m   44m   n/a  0.55%  0.00% O8U25   smore   19

What I see:
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

What version of jvmtop are you using? On what operating system?
JvmTop 0.8.0 alpha

Please post the output of the following commands:
java -version
java version "1.8.0_25"
echo $JAVA_HOME  (for unix/linux systems)
echo %JAVA_HOME% (for windows)
C:\Program Files\Java\jdk1.8.0_25

Please provide any additional information below.
The fix is relatively simple.

in the jvmtop.bat file add quotes. This is the updated file

@echo off
set DIR=%~dp0

"%JAVA_HOME%\bin\java" %JAVA_OPTS% -cp 
"%DIR%/jvmtop.jar;%JAVA_HOME%/lib/tools.jar" com.jvmtop.JvmTop %*

Original issue reported on code.google.com by moresand...@gmail.com on 9 Mar 2015 at 3:22