We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Applet not running
Page Index Toggle Pages: 1
Applet not running (Read 542 times)
Applet not running
Dec 1st, 2009, 9:14am
 
Greetings,

This is my first post, sorry if it should be somewhere else or has already been answered.

My problem: I have created a simple applet which displays the results of a query using Twitter4j. Everything works fine when I run it prior to exporting it as an applet. Much of the core code is from the blprnt blog entry.

However, when I export it to an applet, I get a Java error saying the program cannot run. So, it works on my machine within the processing window, but no longer after being turned into a Java applet.

I tried signing the JAR file as suggested in other forum posts, but no luck. I think there must be something weird about my code and I don't know what it might be. I've also tried the script as well as exporting it to an applet on several computers (Vista 32, Vista 64, and XP) and still no luck.

Here is the code (had to change the website for twitter because this is my first post):


Twitter twitter;

PFont f;

void setup() {
 size(600,100);
 twitter = new Twitter("login", "pass");
 }

void draw(){
 noLoop();
 background(255);
   f = loadFont("Tahoma-12.vlw");
   textFont(f, 14);
 try{
   Query query = new Query("florida");
   query.setRpp(1);
   QueryResult result = twitter.search(query);
   
   ArrayList tweets = (ArrayList) result.getTweets();
   
   for (int i = 0; i < tweets.size(); i++) {
     Tweet t = (Tweet) tweets.get(i);
     String user = t.getFromUser();
     String msg = t.getText();
     String url = ("twitter website" + user);
     Date d = t.getCreatedAt();
     fill(0);
     text("Twitter User: " + user,5,20);
     text("at " + d,300,20);
     text("said: " + msg,5,50,590,40);
   };
 }
 catch (TwitterException te) {
   println("Couldn't connect: " + te);
 }
}
 void mousePressed(){
   background(255);
   redraw();
 }
 
   
Here is the Java console error:
java.lang.NullPointerException
     at sun.plugin2.applet.Plugin2Manager.findAppletJDKLevel(Unknown Source)
     at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
     at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
     at java.lang.Thread.run(Unknown Source)
Exception: java.lang.NullPointerException

A fairly standard error, I think. However, as you can probably tell, I'm very much a novice.

Any and all help is much appreciated!
 

Re: Applet not running
Reply #1 - Dec 1st, 2009, 11:29am
 
You are not the first to get this error (see for example Applet woes..) but I have no idea of what it is.
Check the Processing with external library + HTML thread in case it is related (declaring the jars in the HTML file).

What version of Java is installed on test computers
Re: Applet not running
Reply #2 - Dec 7th, 2009, 7:38am
 
Sorry for the delay in responding, been outta town.

I have the latest version of Java installed on all machines, Version 6 Update 17 (build 1.6.7_17-b04)

Thanks for the other suggestions, didn't quite work, yet.
Page Index Toggle Pages: 1