Python jpype.startJVM() Examples
The following are 12
code examples of jpype.startJVM().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
jpype
, or try the search function
.
Example #1
Source File: jmx.py From integrations-core with BSD 3-Clause "New" or "Revised" License | 7 votes |
def query_endpoint(ctx, host, port, domain): import jpype from jpype import java from jpype import javax url = "service:jmx:rmi:///jndi/rmi://{}:{}/jmxrmi".format(host, port) jpype.startJVM(convertStrings=False) jhash = java.util.HashMap() jmxurl = javax.management.remote.JMXServiceURL(url) jmxsoc = javax.management.remote.JMXConnectorFactory.connect(jmxurl, jhash) connection = jmxsoc.getMBeanServerConnection() query = javax.management.ObjectName("{}:*".format(domain)) beans = connection.queryMBeans(query, None) for bean in list(beans): bean_name = bean.getObjectName().toString() print("Bean: {}".format(bean_name)) info = connection.getMBeanInfo(javax.management.ObjectName(bean_name)) attrs = info.getAttributes() for attr in list(attrs): print(" {:20}: {}".format(str(attr.getName()), attr.getDescription()))
Example #2
Source File: sutime.py From python-sutime with GNU General Public License v3.0 | 5 votes |
def _start_jvm(self, additional_flags): flags = ["-Djava.class.path=" + self._create_classpath()] if additional_flags: flags.extend(additional_flags) jpype.startJVM(jpype.getDefaultJVMPath(), *flags)
Example #3
Source File: duckling.py From python-duckling with Apache License 2.0 | 5 votes |
def _start_jvm(self, minimum_heap_size, maximum_heap_size): jvm_options = [ '-Xms{minimum_heap_size}'.format(minimum_heap_size=minimum_heap_size), '-Xmx{maximum_heap_size}'.format(maximum_heap_size=maximum_heap_size), '-Djava.class.path={classpath}'.format( classpath=self._classpath) ] if not jpype.isJVMStarted(): jpype.startJVM( jpype.getDefaultJVMPath(), *jvm_options )
Example #4
Source File: __init__.py From twkorean with Apache License 2.0 | 5 votes |
def _init_jvm(): if not jpype.isJVMStarted(): jars = [] for top, dirs, files in os.walk(imp.find_module("twkorean")[1] + "/data/lib"): for nm in files: jars.append(os.path.join(top, nm)) jpype.startJVM(jpype.getDefaultJVMPath(), "-Djava.class.path=%s" % os.pathsep.join(jars))
Example #5
Source File: connector.py From NoobSec-Toolkit with GNU General Public License v2.0 | 5 votes |
def connect(self): self.initConnection() try: msg = "what's the location of 'hsqldb.jar'? " jar = readInput(msg) checkFile(jar) args = "-Djava.class.path=%s" % jar jvm_path = jpype.getDefaultJVMPath() jpype.startJVM(jvm_path, args) except Exception, msg: raise SqlmapConnectionException(msg[0])
Example #6
Source File: connector.py From NoobSec-Toolkit with GNU General Public License v2.0 | 5 votes |
def connect(self): self.initConnection() try: msg = "what's the location of 'hsqldb.jar'? " jar = readInput(msg) checkFile(jar) args = "-Djava.class.path=%s" % jar jvm_path = jpype.getDefaultJVMPath() jpype.startJVM(jvm_path, args) except Exception, msg: raise SqlmapConnectionException(msg[0])
Example #7
Source File: connector.py From NoobSec-Toolkit with GNU General Public License v2.0 | 5 votes |
def connect(self): self.initConnection() try: msg = "what's the location of 'hsqldb.jar'? " jar = readInput(msg) checkFile(jar) args = "-Djava.class.path=%s" % jar jvm_path = jpype.getDefaultJVMPath() jpype.startJVM(jvm_path, args) except Exception, msg: raise SqlmapConnectionException(msg[0])
Example #8
Source File: connector.py From NoobSec-Toolkit with GNU General Public License v2.0 | 5 votes |
def connect(self): self.initConnection() try: msg = "what's the location of 'hsqldb.jar'? " jar = readInput(msg) checkFile(jar) args = "-Djava.class.path=%s" % jar jvm_path = jpype.getDefaultJVMPath() jpype.startJVM(jvm_path, args) except Exception, msg: raise SqlmapConnectionException(msg[0])
Example #9
Source File: estimators_jidt.py From IDTxl with GNU General Public License v3.0 | 5 votes |
def _start_jvm(self): """Start JAVA virtual machine if it is not running.""" jar_location = resource_filename(__name__, 'infodynamics.jar') if not jp.isJVMStarted(): jp.startJVM(jp.getDefaultJVMPath(), '-ea', ('-Djava.class.path=' + jar_location))
Example #10
Source File: connection.py From PyAthenaJDBC with MIT License | 5 votes |
def _start_jvm(cls, jvm_path, jvm_options, driver_path, log4j_conf): if jvm_path is None: jvm_path = jpype.get_default_jvm_path() if driver_path is None: driver_path = os.path.join(cls._BASE_PATH, ATHENA_JAR) if log4j_conf is None: log4j_conf = os.path.join(cls._BASE_PATH, LOG4J_PROPERTIES) if not jpype.isJVMStarted(): _logger.debug("JVM path: %s", jvm_path) args = [ "-server", "-Djava.class.path={0}".format(driver_path), "-Dlog4j.configuration=file:{0}".format(log4j_conf), ] if jvm_options: args.extend(jvm_options) _logger.debug("JVM args: %s", args) if jpype.__version__.startswith("0.6"): jpype.startJVM(jvm_path, *args) else: jpype.startJVM( jvm_path, *args, ignoreUnrecognized=True, convertStrings=True ) cls.class_loader = ( jpype.java.lang.Thread.currentThread().getContextClassLoader() ) if not jpype.isThreadAttachedToJVM(): jpype.attachThreadToJVM() if not cls.class_loader: cls.class_loader = ( jpype.java.lang.Thread.currentThread().getContextClassLoader() ) class_loader = jpype.java.net.URLClassLoader.newInstance( [jpype.java.net.URL("jar:file:{0}!/".format(driver_path))], cls.class_loader, ) jpype.java.lang.Thread.currentThread().setContextClassLoader(class_loader)
Example #11
Source File: connector.py From POC-EXP with GNU General Public License v3.0 | 5 votes |
def connect(self): self.initConnection() try: msg = "what's the location of 'hsqldb.jar'? " jar = readInput(msg) checkFile(jar) args = "-Djava.class.path=%s" % jar jvm_path = jpype.getDefaultJVMPath() jpype.startJVM(jvm_path, args) except Exception, msg: raise SqlmapConnectionException(msg[0])
Example #12
Source File: connector.py From EasY_HaCk with Apache License 2.0 | 5 votes |
def connect(self): self.initConnection() try: msg = "what's the location of 'hsqldb.jar'? " jar = readInput(msg) checkFile(jar) args = "-Djava.class.path=%s" % jar jvm_path = jpype.getDefaultJVMPath() jpype.startJVM(jvm_path, args) except Exception, msg: raise SqlmapConnectionException(msg[0])