Usando Pyjnius

from jnius import autoclass def main(): System = autoclass('java.lang.System') ArrayList = autoclass('java.util.ArrayList') System.out.println("*** Clases Java en Python ***") lista = ArrayList() lista.add(0,1) lista.add(1,2) lista.add(2,3) System.out.println("Tamaño de la lista: "+str(lista.size())) System.out.println(lista.toString()) Math = autoclass('java.lang.Math') System.out.println("El maximo de 2 y 3 es: "+str(Math.max(2,3))) JOptionPane = autoclass('javax.swing.JOptionPane') JOptionPane.showMessageDialog(None, "Hola, mundo desde Python") JOptionPane.showMessageDialog(None, "Hola, mundo desde Python!!!","Este es un mensaje de informacion",JOptionPane.PLAIN_MESSAGE) System.exit(0) if __name__ == '__main__': main()

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.