示例#1
0
def start(path=None, *args):
    if path is None:
        from pyjava.find_dll import find_dll
        path = find_dll()
    try:
        if len(args) == 0:
            _pyjava.start(path, [])
        elif len(args) == 1 and (isinstance(args[0], list)):
            _pyjava.start(path, args[0])
        else:
            _pyjava.start(path, args)
    except Error:
        raise Error("Unable to start Java VM with path %s" % path)
示例#2
0
文件: base.py 项目: remram44/pyjava
    def setUpClass(cls):
        if hasattr(PyjavaTestCase, '_pyjava_started'):
            return

        import _pyjava
        from pyjava.find_dll import find_dll

        dll = find_dll()
        if not dll:
            sys.stderr.write(
                "No suitable JVM DLL found. Please set your JAVA_HOME "
                "environment variable.\n")
            sys.exit(1)
        else:
            sys.stderr.write("Running tests with JVM DLL: %s\n" % dll)

        # This need to be called once, before running the test suite
        _pyjava.start(dll, ['-Djava.class.path=tests/java-tests.jar'])

        PyjavaTestCase._pyjava_started = True
示例#3
0
文件: base.py 项目: remram44/pyjava
    def setUpClass(cls):
        if hasattr(PyjavaTestCase, '_pyjava_started'):
            return

        import _pyjava
        from pyjava.find_dll import find_dll


        dll = find_dll()
        if not dll:
            sys.stderr.write("No suitable JVM DLL found. Please set your JAVA_HOME "
                             "environment variable.\n")
            sys.exit(1)
        else:
            sys.stderr.write("Running tests with JVM DLL: %s\n" % dll)


        # This need to be called once, before running the test suite
        _pyjava.start(dll, ['-Djava.class.path=tests/java-tests.jar'])

        PyjavaTestCase._pyjava_started = True
示例#4
0
    def setUpClass(cls):
        if hasattr(PyjavaTestCase, '_pyjava_started'):
            return

        import _pyjava
        from pyjava.find_dll import find_dll


        dll = find_dll()
        if not dll:
            sys.stderr.write("No suitable JVM DLL found. Please set your JAVA_HOME "
                             "environment variable.\n")
            sys.exit(1)
        else:
            sys.stderr.write("Running tests with JVM DLL: %s\n" % dll)


        # This need to be called once, before running the test suite
        class_path = os.path.join(test_java, "classes")  # <AK> added
        _pyjava.start(dll, ["-Djava.class.path={}".format(class_path)])

        PyjavaTestCase._pyjava_started = True
示例#5
0
 def test_find_dll(self):
     dll = find_dll()
     self.assertIsNotNone(dll)