本文整理汇总了Python中java.lang.ClassLoader.getSystemResource方法的典型用法代码示例。如果您正苦于以下问题:Python ClassLoader.getSystemResource方法的具体用法?Python ClassLoader.getSystemResource怎么用?Python ClassLoader.getSystemResource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.lang.ClassLoader
的用法示例。
在下文中一共展示了ClassLoader.getSystemResource方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: actionPerformed
# 需要导入模块: from java.lang import ClassLoader [as 别名]
# 或者: from java.lang.ClassLoader import getSystemResource [as 别名]
def actionPerformed(self, event):
browsers = ["google-chrome", "firefox", "opera", "epiphany", "konqueror", "conkeror", "midori", "kazehakase", "mozilla"]
osName = System.getProperty("os.name")
helpHTML = ClassLoader.getSystemResource("help.html").toString()
if osName.find("Mac OS") == 0:
Class.forName("com.apple.eio.FileManager").getDeclaredMethod( "openURL", [String().getClass()]).invoke(None, [helpHTML])
elif osName.find("Windows") == 0:
Runtime.getRuntime().exec( "rundll32 url.dll,FileProtocolHandler " + helpHTML)
else:
browser = None
for b in browsers:
if browser == None and Runtime.getRuntime().exec(["which", b]).getInputStream().read() != -1:
browser = b
Runtime.getRuntime().exec([browser, helpHTML])
示例2: getResourceDirectoryForModuleName
# 需要导入模块: from java.lang import ClassLoader [as 别名]
# 或者: from java.lang.ClassLoader import getSystemResource [as 别名]
def getResourceDirectoryForModuleName(moduleName):
resourceDirectory = None
try:
prefix = "content/"
moduleNamePath = moduleName.replace(".", "/")
resourcePath = prefix + moduleNamePath
if PYCYCLE_DEBUG_RESOURCE_ROOT is None:
# serving from the "content" directory embedded in the JAR file
resourceDirectory = _ClassLoader.getSystemResource(resourcePath).toExternalForm()
#
else:
# serving from the "content" directory from the debug root
resourceDirectory = _File(PYCYCLE_DEBUG_RESOURCE_ROOT, resourcePath).toString()
#
#
except Exception as ex:
message = "Could not get resource directory for module '" + str(moduleName) + "'. "
message += "Caused by: \n" + repr(ex)
raise RuntimeError(message)
#
return resourceDirectory