add an extra check for JAVA_HOME

git-svn-id: file:///home/svn/framework3/trunk@11118 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Joshua Drake 2010-11-24 01:11:17 +00:00
parent fb79d97bca
commit db28497900
1 changed files with 8 additions and 3 deletions

View File

@ -38,15 +38,20 @@ module Exploit::Java
end
end
def init_jvm(jvmoptions=nil)
def init_jvm(jvmoptions = nil)
if (not ENV['JAVA_HOME'])
raise RuntimeError, 'Please set JAVA_HOME'
raise RuntimeError, 'JAVA_HOME is not set'
end
toolsjar = File.join(ENV['JAVA_HOME'], "lib", "tools.jar")
if (not File.exists? toolsjar)
raise RuntimeError, 'JAVA_HOME does not point to a valid JDK installation.'
end
# Instantiate the JVM with a classpath pointing to the JDK tools.jar
# and our javatoolkit jar.
classpath = File.join(Msf::Config.install_root, "data", "exploits", "msfJavaToolkit.jar")
classpath += ":" + File.join(ENV['JAVA_HOME'], "lib", "tools.jar")
classpath += ":" + toolsjar
classpath += ":" + datastore['ADDCLASSPATH'] if datastore['ADDCLASSPATH']
Rjb::load(classpath, jvmargs=[])