Quick Cacio-Web howto

Today we released Caciocavallo 1.3. The release announcement can be found here.

However, what is the more important news is that after the release, I fixed Cacio-Web to work with the latest Cacio build and enabled it in the default build so it doesn’t fall to the wayside again. On popular request I would like to summarize how to get Cacio-Web running. Note that this currently only works on Linux (patches to enable this on other platforms are welcome!)

First of all, check out the source code (the cacio-web changes are not yet released):

hg clone http://hg.openjdk.java.net/caciocavallo/ng/ caciocavallo

Then build it (you need Maven!):

cd caciocavallo
mvn clean install

And finally you should be able to run with with something like this:

java -Dcacio.web.port=9091 -cp cacio-web/target/cacio-web-1.4-SNAPSHOT-jar-with-dependencies.jar:/home/rkennke/src/test/SwingSet2.jar net.java.openjdk.cacio.server.CacioServer

The -Dcacio.web.port parameter specifies on which port should Cacio-Web listen. Notice that the classpath needs to include your application (SwingSet2.jar in this case).

Then point your browser to a URL like this:


http://localhost:9091/SessionInitializer?cls=SwingSet2

Where the parameter cls specifies the (fully qualified) name of the main class of the application to start.

Please let me know if you run into any problems.

About these ads

14 Responses to Quick Cacio-Web howto

  1. Frank Grimes says:

    Latest fails to compile on Mac OS X 10.8.2:

    gcc –version
    i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)

    gcc -c -Wall -fPIC -I target -I src/main/c -I /include/ -I /include/linux target/WebSurfaceData.c -o target/WebSurfaceData.o
    target/WebSurfaceData.c:25:17: error: jni.h: No such file or directory
    In file included from src/main/c/cacio-web.h:29,
    from target/WebSurfaceData.c:27:
    src/main/c/SurfaceData.h:48: error: expected specifier-qualifier-list before ‘jint’
    src/main/c/SurfaceData.h:156: error: expected specifier-qualifier-list before ‘jint’
    src/main/c/SurfaceData.h:251: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘LockFunc’
    src/main/c/SurfaceData.h:294: error: expected ‘)’ before ‘*’ token
    src/main/c/SurfaceData.h:334: error: expected ‘)’ before ‘*’ token
    src/main/c/SurfaceData.h:366: error: expected ‘)’ before ‘*’ token
    src/main/c/SurfaceData.h:390: error: expected ‘)’ before ‘*’ token
    src/main/c/SurfaceData.h:398: error: expected ‘)’ before ‘*’ token
    src/main/c/SurfaceData.h:437: error: expected specifier-qualifier-list before ‘LockFunc’
    src/main/c/SurfaceData.h:548: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘SurfaceDataOps’
    src/main/c/SurfaceData.h:555: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘SurfaceDataOps’
    src/main/c/SurfaceData.h:571: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
    src/main/c/SurfaceData.h:594: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
    src/main/c/SurfaceData.h:603: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
    src/main/c/SurfaceData.h:612: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
    src/main/c/SurfaceData.h:622: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
    src/main/c/SurfaceData.h:635: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
    src/main/c/SurfaceData.h:651: error: expected ‘)’ before ‘*’ token
    src/main/c/SurfaceData.h:659: error: expected ‘)’ before ‘*’ token
    In file included from target/WebSurfaceData.c:27:
    src/main/c/cacio-web.h:37: error: expected specifier-qualifier-list before ‘jintArray’
    target/WebSurfaceData.c:29: error: expected ‘)’ before ‘*’ token
    target/WebSurfaceData.c:31: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘sunToolkitCls’
    target/WebSurfaceData.c:32: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘sunToolkitLockMID’
    target/WebSurfaceData.c:33: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘sunToolkitUnlockMID’
    target/WebSurfaceData.c:35: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘lockSurfaceMID’
    target/WebSurfaceData.c:36: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘unlockSurfaceMID’
    target/WebSurfaceData.c:38: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘webSurfaceCls’
    target/WebSurfaceData.c:39: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘dirtyRectMID’
    target/WebSurfaceData.c:41: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘WebLock’
    target/WebSurfaceData.c:43: error: expected ‘)’ before ‘*’ token
    target/WebSurfaceData.c:45: error: expected ‘)’ before ‘*’ token
    target/WebSurfaceData.c:47: error: expected ‘)’ before ‘*’ token
    target/WebSurfaceData.c:49: error: expected ‘)’ before ‘*’ token
    target/WebSurfaceData.c:52: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
    target/WebSurfaceData.c:81: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
    target/WebSurfaceData.c:99: error: expected ‘)’ before ‘*’ token
    target/WebSurfaceData.c:108: error: expected ‘)’ before ‘*’ token
    target/WebSurfaceData.c:117: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘WebLock’
    target/WebSurfaceData.c:156: error: expected ‘)’ before ‘*’ token
    target/WebSurfaceData.c:181: error: expected ‘)’ before ‘*’ token
    make: *** [target/WebSurfaceData.o] Error 1
    [INFO] ————————————————————————
    [INFO] Reactor Summary:
    [INFO]
    [INFO] Caciocavallo Main Module …………………….. SUCCESS [10.509s]
    [INFO] Cacio Shared Module …………………………. SUCCESS [9.030s]
    [INFO] CacioTAA Java Module ………………………… SUCCESS [1:30.468s]
    [INFO] CacioWeb Module …………………………….. FAILURE [54.146s]
    [INFO] ————————————————————————
    [INFO] BUILD FAILURE

    • Roman Kennke says:

      Ok yes, it wouldn’t compile on OS X. I can’t fix it myself, because I currently don’t have access to such a machine. From what I can tell, what needs to be done, is to fix the cacio-web/Makefile to use the correct include paths (i.e. not linux) and also it looks like $JAVA_HOME is not set correctly from Maven to Makefile.

  2. I think I knew this already, but I just tried on my OSX machine and it failed with Java 6.

    So perhaps your article should underline the system requirements for such a build.

    It basically needs Linux, Java 7 as well as, probably, gcc for native stuff.

    • Roman Kennke says:

      Hi Emilian,

      Yes, for now the requirements are Java7 (can’t do anything for Java6, sorry), Linux and GCC. The latter 2 should be fairly easy to fix for other platforms, it’s just that I don’t have access to anything else, otherwise I’d do it. The native part of Cacio-Web is really small and portable, this shouldn’t be a problem to compile on OS X.

  3. xranby says:

    It work! I Successfully ran AlienSwarm http://www.checkmypages.com/swarm/ using Cacio-Web & OpenJDK 7 inside the Firefox html5 canvas. 50fps

    photo/1

  4. xranby says:

    Nice, i managed to use this to run a AWT based AlienSwarm arcadegame across the network using cacio-web https://twitter.com/i/#!/xranby/media/slideshow?url=pic.twitter.com%2Fq19moPwH

  5. Linuxhippy says:

    Roman: Thanks for writing the tutorial. Sorry its become so quiet arround CacioWeb…

    xranby: cool :)

  6. Akash S says:

    It gives a test error in Cacio-TTA Java module.
    Results :

    Tests in error:
    testDrag(net.java.openjdk.cacio.ctc.DragMouseTest): Index: 1, Size: 1

    Tests run: 17, Failures: 0, Errors: 1, Skipped: 0

    [INFO] ————————————————————————
    [INFO] Reactor Summary:
    [INFO]
    [INFO] Caciocavallo Main Module …………………….. SUCCESS [1.301s]
    [INFO] Cacio Shared Module …………………………. SUCCESS [14.101s]
    [INFO] CacioTAA Java Module ………………………… FAILURE [1:29.895s]
    [INFO] CacioWeb Module …………………………….. SKIPPED
    [INFO] ————————————————————————
    [INFO] BUILD FAILURE
    [INFO] ————————————————————————
    [INFO] Total time: 1:45.623s
    [INFO] Finished at: Thu Dec 20 13:00:51 IST 2012
    [INFO] Final Memory: 21M/97M
    [INFO] ————————————————————————
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project cacio-tta: There are test failures.
    [ERROR]
    [ERROR] Please refer to /home/akash/cacioweb/caciocavallo/cacio-tta/target/surefire-reports for the individual test results.
    [ERROR] -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
    [ERROR]
    [ERROR] After correcting the problems, you can resume the build with the command
    [ERROR] mvn -rf :cacio-tta

  7. Kai says:

    Your project is exactly what we’ve been looking for!
    What do you think, needs to be changed for a MS Windows port. I am currently stuck in the makefile: WebSurfaceData.o cannot be found :/ I think a straight way is not that easy, huh?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 159 other followers

%d bloggers like this: