当前位置: 首页>>代码示例>>Python>>正文


Python jpype.startJVM方法代码示例

本文整理汇总了Python中jpype.startJVM方法的典型用法代码示例。如果您正苦于以下问题:Python jpype.startJVM方法的具体用法?Python jpype.startJVM怎么用?Python jpype.startJVM使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jpype的用法示例。


在下文中一共展示了jpype.startJVM方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: query_endpoint

# 需要导入模块: import jpype [as 别名]
# 或者: from jpype import startJVM [as 别名]
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())) 
开发者ID:DataDog,项目名称:integrations-core,代码行数:24,代码来源:jmx.py

示例2: _start_jvm

# 需要导入模块: import jpype [as 别名]
# 或者: from jpype import startJVM [as 别名]
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) 
开发者ID:FraBle,项目名称:python-sutime,代码行数:7,代码来源:sutime.py

示例3: _start_jvm

# 需要导入模块: import jpype [as 别名]
# 或者: from jpype import startJVM [as 别名]
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
            ) 
开发者ID:FraBle,项目名称:python-duckling,代码行数:14,代码来源:duckling.py

示例4: _init_jvm

# 需要导入模块: import jpype [as 别名]
# 或者: from jpype import startJVM [as 别名]
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)) 
开发者ID:jaepil,项目名称:twkorean,代码行数:10,代码来源:__init__.py

示例5: connect

# 需要导入模块: import jpype [as 别名]
# 或者: from jpype import startJVM [as 别名]
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]) 
开发者ID:krintoxi,项目名称:NoobSec-Toolkit,代码行数:13,代码来源:connector.py

示例6: _start_jvm

# 需要导入模块: import jpype [as 别名]
# 或者: from jpype import startJVM [as 别名]
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)) 
开发者ID:pwollstadt,项目名称:IDTxl,代码行数:8,代码来源:estimators_jidt.py

示例7: _start_jvm

# 需要导入模块: import jpype [as 别名]
# 或者: from jpype import startJVM [as 别名]
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) 
开发者ID:laughingman7743,项目名称:PyAthenaJDBC,代码行数:39,代码来源:connection.py


注:本文中的jpype.startJVM方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。