Double clicking startMQMonitor.bat for the Websphere MQ Agent shows output of "Exception in thread "main" java.lang.NoClassDefFoundError: Files."

Document ID : KB000031670
Last Modified Date : 14/02/2018
Show Technical Document Details


Running the startMQMonitor.bat fails and shows output of  "Exception in thread "main" java.lang.NoClassDefFoundError: Files."



Application Server: Websphere MQ 7.0
APM Agent : MQ Agent 9.1.7.
Operating System: Windows 2008 R2
Java Version: JVM IBM JDK 6.0



Incorrect MQMonitor.bat configuration. 



Important:  Make sure any paths are defined by double quotes on the Application Startup Script. 

1.  Please see below a sample trace output. Note in bold the root cause (Java Command argument of Program File with an embedded blank) and the corresponding error (java.lang.NoClassDefFoundError: Files). 

C:\Introscope\MQPowerPack\MQMonitor_Test>"C:\Program Files\Java\jre6"\bin\java -Xms64m -Xmx1024m -cp MQMonitor.jar;.\lib\Agent.jar;C:\Program Files (x86)\IBM\WebSphere MQ\java\lib\test.jar;;.; -Dcom.wily.introscope.agentProfile=.\MQPowerPack\IntroscopeAgent.profile  
-DProperties=.\MQPowerPack\ com.wily.powerpack.websphereMQ.agent.MQMonitor.MQMonitor
Exception in thread "main" java.lang.NoClassDefFoundError: Files
Caused by: java.lang.ClassNotFoundException: Files
        at$ Source)
        at Method)
        at Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: Files.  Program will exit.

2.  Correct the Startup Script. Please see a sample of "correct" and "incorrect" entries. 

    Incorrect:(a space in path)
set TEST_JAR=C:\Program Files (x86)\IBM\WebSphere MQ\java\lib\test.jar
Correct:(defined with double quotes)
set TEST_JAR="C:\Program Files (x86)\IBM\WebSphere MQ\java\lib\test.jar"