[Solved] Try & Catch not found in processing 2.x versions..... Help !

edited February 2014 in Questions about Code

Hi, I have been trying to run my old code on new version of processing 2.x and it reported me an error "cannot find a class or type name of "connectException" so I tried running the same code on processing 1.5.1 and it worked like charm without throwing any error.


void setup() {
  size(600, 400);
  ThinkGearSocket neuroSocket = new ThinkGearSocket(this);
  try {
  catch (ConnectException e) {
    //println("Is ThinkGear running??");

Please help.

I have tried importing this but it didn't work.

import java.util.*;

Do I have to import any thing else ?

  1. ConnectException is not available I think Try & catch working fine in processing.
  2. I have tried importing import java.rmi.*; but now it shows unhandled exception type ConnectException
  3. After that I have tried importing import java.net.*; and now it shows The type ConnectException is ambiguous


  • edited February 2014 Answer ✓

    Are we supposed to know what is a ThinkGearSocket??? :-??

    Anyways, there are 2 ConnectException classes. Import 1 or both and check if any works!


    import java.net.ConnectException;
  • edited February 2014

    @GoToLoop Thanks you and sorry for ThinkGearSocket.

    Yes I tried both but both them are giving error. (mentioned above)

    It is basically Neurosky Mindwave socket. Neurosky mindwave is a commercially available EEG sensor for researcher and developer monitering eeg signals (brainwave).

    Earlier I have been working on this but then I started developing for kinect sensor now I have started again and find difficult to run my old code on processing.


    import java.net.*; // it worked

    but together it was not working :) thanks a lot GotoLoop

  • edited February 2014

    Since you're not sure what is the Exception class you need, how about catch-all? X_X

    catch (Throwable t) { // blah, blah, blah...! }


  • edited February 2014

    But together it was not working.

    I've 1st said to import 1. By "both" I've meant try both. But forgot to warn you not at the same time! 8-X

    And rather than a generic import java.net.*;, better be more specific:

    Either -> import java.net.ConnectException; or import java.rmi.ConnectException;.

  • I doubt that's the RMI version, as it is a very specific protocol.

Sign In or Register to comment.