/java_visualize

Visualization for Java, using the Online Python Tutor frontend

Primary LanguageJavaScriptGNU Affero General Public License v3.0AGPL-3.0

java_visualize: visualization for java
David Pritchard (daveagp@gmail.com), created May 2013

This is the frontend for a Java visualizer. It is based on "Online Python Tutor",
a Python visualizer by Philip Guo. Try it at these mirrors (as of time of writing): 

      http://cscircles.cemc.uwaterloo.ca/java_visualize/ (Java 8)
      http://www.cs.princeton.edu/~cos126/java_visualize/ (Java 7)

The Online Python Tutor repo contains both a frontend and backend.
For Java wre readapt the frontend (so this repo contains OnlinePythonTutor
as a subrepo) and replace the backend (it is in the java_jail repo mentioned
below, since it runs in a sandbox).

INSTALLATION

Install these on your server first:
 https://github.com/cemc/safeexec
 https://github.com/daveagp/java_jail 
This requires root access. See the instructions therein for details. It is best to
install these in locations that are not served to users by your web server.

Next, in some folder accessible to your web server, run

    git clone --recursive https://github.com/daveagp/java_visualize

It's recursive because it includes two submodules. Because of this, 
to update, use the pair of commands
    git pull; git submodule update

At this point, visiting
 http://your.website/url/to/java_visualize/
should give you a beautiful (but non-working) frontend, and
 http://your.website/url/to/java_visualize/java_safe_ram_maketrace.php
should give you a "Couldn't find jv-config.json" error.

Next, copy jv-config.example.json to jv-config.json. Now visiting
 http://your.website/url/to/java_visualize/java_safe_ram_maketrace.php
should give you a "http mangling" error.

Finally, edit jv-config.json to indicate where you installed safeexec 
and java_jail. (Just those first two entries need to be changed right now.)

Now, try the visualizer out!

THE "C++ VISUALIZER"
See cpp_visualizer.txt.

FAQ
 -- click on "Click for FAQ" on the visualizer page

MORE INFO
 -- index.html is a modified version of visualize.html 
 -- jv-frontend.js is a modified version of opt-frontend.js
 -- java_safe_ram_maketrace.php connects the frontend to the backend
 -- config.* is used for configuration stuff specific to your server
 -- pytutor-customizations.{js,css} overrides some behaviour of OPT
 -- example-code is a directory full of example Java files to visualize

Note that in the entire frontend, only the two .php files are
written in a server-side language. Everything else we use is static,
although OnlinePythonTutor has some server-side files that this Java
version does not use.

If you use a database, you'll be putting a DB password in jv-config.json.
Please check that
 http://your.website/url/to/java_visualize/jv-config.json
is inaccessible; .htaccess tries to do this, but you should confirm it works.

====

The modified files (index.html, jv-frontend.js) retain the MIT license 
under which they were published in the OnlinePythonTutor repo. 

The other files are released under
the GNU Affero General Public License, versions 3 or later. See LICENSE
or visit: http://www.gnu.org/licenses/agpl.html