My exported application won't run!

edited May 2014 in Using Processing

I have updated java, and when I run my program in processing, it works fine, but when I export it, it won't launch :( Although some basic example from processing works fine when exported, but mine won't launch. I think it's because there's something on the program? Anyone knows how to fix it? It would be a very big help for me. Here's the code,

 import processing.serial.*;
 Serial port;

 void setup()  {
 port = new Serial(this, Serial.list()[0], 9600);  // Open the port that the Arduino board is connected to, at 9600 baud

}
 void draw() {

  String onoroff[] = loadStrings("C:/xampp/htdocs/DoorlockTest/LEDstate.txt"); // Insert the location of your .txt file
  print(onoroff[0]);  // Prints whatever is in the file ("1" or "0")

  if (onoroff[0].equals("1") == true) {
    println(" - TELLING ARDUINO TO TURN LED ON");
    port.write('H'); // Send "H" over serial to set LED to HIGH


  } else {

    println(" - TELLING ARDUINO TO TURN LED OFF");
    port.write('L');  // Send "L" over serial to set LED to LOW

 }

  delay(1000); // Set your desired interval here, in milliseconds
 }

anyway this isn't my work, I just copy pasted it from somewhere in google, credits to the programmer.

Answers

  • First, you should read To newcomers in this forum: read attentively these instructions, about formatting.

    What version of Processing do you use? I believe the latest versions have made improvements in the field of exports. But sketches using the serial port can be harder to export, try first on simpler sketches, to see if it works.

  • edited May 2014

    Same thing happens to one of my sketches that use these libraries:

        import ddf.minim.*;
        import org.gamecontrolplus.*;
        import net.java.games.input.*;
    

    I am using the newest version of Proce55ing (2.2.1)

  • edited May 2014

    @PhiLho, @mcspud: I'm using the 2.2.1 version of processing sir, I also tried to export basic samples of processing, and it works fine and btw, what I meant is that the application that I exported wont launch. I think I believe that using serial port can be harder to export, are there any steps for it to work? Should I use the older version?Anyway, Thanks a lot for responding!

  • Same thing with me, it exports, but doesn't run when double clicked. 2.0.3 works however.

  • Answer ✓

    @mcspud If you use the 32-bit version of Processing 2.0.3, it is a known bug, fixed in later versions (AFAIK).

  • If you use 2.2.1, check if both 32 and 64 bit versions don't work. On my system only the 32 bit version works but not the 64 bit... (It won't even attempt to export to OSX and Linux).

  • I'm on a 32bit system window 7. Both 32 and 64 won't work. :(

  • edited June 2014

    Same thing with me, it exports, but doesn't run when double clicked. I am using the newest version of Processing (2.2.1). i use Chinese text Font and text(Chinese);

    import ddf.minim.*;
    Minim minim;
    AudioPlayer snip;
    import processing.serial
    Serial serial_port
    int data_key
    PFont myFont = createFont("草泥马体", 32); 
    void draw() 
    {
        while(serial_port.available()>0 )
        {
           fill(40,30,20);
           rect(150,200,580,80);
    
       fill(240,220,200);
       text("电场探测结果是:",150,260);//chinese text
       ... ...
    
  • New released version of processing worked for this. :D

  • I have the same problem:

    • Processing 2.2.1
    • Windows 7 64-bit
    • A test project (drawing and ellipse) works fine both from within Processing IDE and exported
    • A useful project, which includes processing.serial.*, runs just fine when launched from the IDE, but produces a blank window when exported. Also, the serial device (an Arduino) flashes the RXTX when run within the IDE, but not when exported. So it's almost surely the serial class.
    • Finally, the program exports under linux (ubuntu 12.04, I think) just fine.

    Anyone have a solution to this, yet?

  • edited August 2014

    @G_Luv Just like what ive said earlier, new released version of processing worked for this problem, they fixed it already. Download the new version (3.0a2).

  • Ah, I thought you meant v2.2.1 (the latest release version).

    It works under 3.0a2.

    Thanks!

  • I'm having a similar issue (with Processing 2.2.1 and with 3.0a3) I'm running Processing 2.2.1 along with SimpleOpenNI 1.96 (based on instructions at http://shiffman.net/p5/kinect/). I modified the DepthImage example sketch and added file writing (code below).

    I'm trying to output the depth data from Kinect to .txt files in a folder of my choice. In the Processing IDE, the sketch runs fine; the depth is written to the files correctly.

    However I would like this functionality in an .exe file so that another program can run this .exe and read from those files, at run time. Export functionality in Processing IDE runs without errors and I get both win32 and win64 application folder. But if I execute .exe present in either one of them, nothing happens; I cannot see any errors anywhere. Even if I select "Present Mode" while exporting, only a gray screen appears but I cannot see any files being written to the path I supply. Toggle various selections (PresentMode/Export java) on the Export options windows hasn't helped.

    I also tried to use savePath() because someone else (not using a kinect application) was able to write data into folders using that. But it did not work for me.

    Following is my sketch that works correctly in the IDE:

    import SimpleOpenNI.*;
    SimpleOpenNI  context;
    
    int[] dmap;
    int dsize;
    float[] dmapf;
    PrintWriter output;
    int fitr;
    String path;
    
    void setup()
    {
       size(640*2, 480);
       fitr=1;
       context = new SimpleOpenNI(this);
       if (context.isInit() == false)
       {
            println("Can't init SimpleOpenNI, maybe the camera is not connected!"); 
            exit();
            return;
       }
    
    
    
     // mirror is by default enabled
      context.setMirror(false);
    
      // enable depthMap generation 
      context.enableDepth();
    
      // enable ir generation
      context.enableRGB();
    
      path = savePath("E:\\SYMMBOT\\DepthReading");  
    }
    
    void draw()
    {
      // update the cam
      context.update();
      dmap = context.depthMap();
      //dmapf = dmap.array();
    
      output = createWriter(path+"\\depth"+fitr+".txt");
      fitr++;
      int itr = 0;
      for(int i=0; i<480; i++){
        for(int j=0;j<640;j++){
          output.print(dmap[itr]+" ");
          itr++;
        }
        output.println();
      }
      output.flush();
      output.close();
      //dsize = context.depthMapSize();
      background(200, 0, 0); //<>//
    
      // draw depthImageMap
      image(context.depthImage(), 0, 0);
    
      // draw irImageMap
      image(context.rgbImage(), context.depthWidth() + 10, 0);
    }
    
Sign In or Register to comment.