How to run Processing+Twitter4j sketch in broswer

后端 未结 1 1950
时光取名叫无心
时光取名叫无心 2021-01-24 08:53

I\'m a newbie programmer practicing Processing and I recently developed a sketch that uses Twitter4j. When I run the sketch in Java mode from the Processing Development Environm

相关标签:
1条回答
  • 2021-01-24 09:45

    Your comment is correct: your sketch won't work under JavaScript mode, because you're using a Java library. As long as you depend on a Java library, your code will only work in Java mode. You might want to check out the JavaScript console for error messages.

    To solve the issue, you could try to look for an equivalent JavaScript library and use that instead of twitter4j. Then your code would work in JavaScript mode. That's probably the correct thing to do.

    The reason I say that is it's a huge pain to get Java applications to run in the browser. You'd have to create an applet, and then either sign the jar with a paid certificate, or have your users modify their Java security settings- and even then, your users will get a bunch of security warnings and prompts before they run your applet.

    You're better off either deploying as a runnable jar or platform-specific executable, or switching entirely to JavaScript mode by finding an equivalent JavaScript library.

    0 讨论(0)
提交回复
热议问题