Skip to content

Instantly share code, notes, and snippets.

@ydm
Created October 22, 2013 13:47
Show Gist options
  • Select an option

  • Save ydm/7101096 to your computer and use it in GitHub Desktop.

Select an option

Save ydm/7101096 to your computer and use it in GitHub Desktop.
Print current Java classpath using Pyjnius
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from jnius import autoclass, cast
def get_classpath():
ClassLoader = autoclass('java.lang.ClassLoader')
cl = ClassLoader.getSystemClassLoader()
ucl = cast('java.net.URLClassLoader', cl)
urls = ucl.getURLs()
return [url.getFile() for url in urls]
def main():
print('\n'.join(get_classpath()))
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment