Git Product home page Git Product logo

rjyc's Introduction

Overview

This is a remote Python console allowing to manipulate your JVM application in runtime.

See my article in Russian for more details.

Maven Artifacts

  1. Add following repository definition to pom.xml:

     <repository>
       <id>Rjyc Repository</id>
       <url>http://siasia.github.com/maven2</url>
     </repository>
    
  2. and a dependency itself:

     <dependency>
       <groupId>org.python</groupId>
       <artifactId>rjyc</artifactId>
       <version>1.0-SNAPSHOT</version>
     </dependency>
    

Usage

  1. Inject the remote console server into the project:

     import net.rjyc.Server;
     import java.util.*;
    
     public class Test {
       public int test;
       public static void main(String [] args) {
         Map<String, Object> locals = new HashMap<String, Object>() { //create locals for your interpreter
           put("context", new Test());
         };
         /* start the server listening for localhost:8080 
          * with a context variable set to the instance of Test
          */
         new Server("localhost", 8080, locals).start(); 
       }
     }
    
  2. Grab client.py and run it like this:

     siasia@siasia ~/projects/rjyc % python2 client.py localhost 8080
     >>> print 1
     1
     >>> for i in range(1, 5):
     ...     print i
     ... 
     1
     2
     3
     4
     >>> context
     Test@7c9586
     >>> context.test
     0
     >>> context.test = 1
     >>> context.test
     1
     >>> context.
     context.__class__         context.__hash__          context.__reduce_ex__     context.equals            context.notifyAll
     context.__delattr__       context.__init__          context.__repr__          context.getClass          context.test
     context.__doc__           context.__ne__            context.__setattr__       context.hashCode          context.toString
     context.__eq__            context.__new__           context.__str__           context.main              context.wait
     context.__getattribute__  context.__reduce__        context.class             context.notify            
     >>> import java
     >>> java.
     java.__name__  java.io        java.lang      java.net       java.nio        java.security  java.util      
     >>> java.io.FileOutputStream('/tmp/test.txt')
     java.io.FileOutputStream@fd5428
    

rjyc's People

Contributors

aolshevskiy avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.