2

I am trying to run a Processing sketch in JavaScript mode. It does open the browser the display the brown-ish screen however it does not do anything apart from that. It does not load my sketch in it.

I did try changing the firewall settings to allow it in Private Networks but to no avail.

I am using Processing 2.0 on a Windows 7 32 bit machine.
I also have the latest JRE on my machine.

How do I make it work?

Update

It also needed the latest version of JDK, jdk_7_u21. Although the applet does run in the browser, it does not load the background image. This sketch was made to allow the user to add a pixelated effect to the image. In java mode it works perfectly fine. enter image description here

An SO User
  • 24,612
  • 35
  • 133
  • 221
  • did you check the browser's error console? What does it report? – Mike 'Pomax' Kamermans Jun 15 '13 at 19:20
  • @Mike'Pomax'Kamermans It reports no error. I updated to latest Java version but it still doesn't work properly. Need screenshot ? – An SO User Jun 16 '13 at 05:23
  • 1
    In this case having code is more important than a screenshot: reduce your code so that it only contains the code that doesn't work according to you, so people can see what you're doing, and how. Usually during this process you tend to go "oh wait, of course it's going wrong, I'm doing ..." and manage to fix it yourself. However, if after reducing the problem still exists, you now have small, manageable code for others to look at and help you with. – Mike 'Pomax' Kamermans Jun 16 '13 at 14:53
  • Are you using any libraries that aren't available for processing.js? – Timothy Groote Jun 20 '13 at 14:32
  • @TimothyGroote Yes, one that was provided with my COursera course. For loading and playing sound. – An SO User Jun 20 '13 at 15:09
  • 1
    Well simply put, you cannot use any Java libraries in js mode. remove the dependency on the libraries and the reference to the libraries, then try again. – Timothy Groote Jun 20 '13 at 18:54
  • Timothy Groote's right; out of curiosity, are you using Maxim? (I suspect we were in the same Coursera class) If so, there is a separate js version you can use. Otherwise,the asnwer to this question might be helpful: http://stackoverflow.com/questions/16879981/exporting-a-processing-sketch-with-audio-to-javascript – RSid Aug 13 '13 at 21:12
  • @RSid Oh yes, we were in the same course then. How are you, Courserian ? :D – An SO User Aug 14 '13 at 06:16
  • 1
    @LittleChild Haha, not bad. Still tinkering around with my Processing projects too :p – RSid Aug 15 '13 at 15:40

1 Answers1

4

Here's what I think is an answer to your question "How do I run a Processing sketch using Processing.js on a browser:

You very simply could run it in an HTML5 canvas object by just creating the tag and importing all the processing files you need like so:

<canvas id="canvas1" data-processing-sources="file1.pde file2.pde fileN.pde"></canvas>

Now if you are against using canvases and wanted to keep away from HTML5 then it's a different story.

ZekeDroid
  • 7,089
  • 5
  • 33
  • 59