# Exporting sketch - crash on startup (MAC)

**URL:** https://discourse.processing.org/t/exporting-sketch-crash-on-startup-mac/9230
**Category:** Libraries
**Created:** [March 12, 2019, 1:04pm UTC](https://discourse.processing.org/t/exporting-sketch-crash-on-startup-mac/9230 "2019-03-12T13:04:37Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![has\_sanity](https://avatars.discourse-cdn.com/v4/letter/h/e0b2c6/32.png) [@has\_sanity](https://discourse.processing.org/u/has_sanity)
#### Post date: [March 12, 2019, 1:04pm UTC](https://discourse.processing.org/t/exporting-sketch-crash-on-startup-mac/9230/1 "2019-03-12T13:04:37Z")

</div>

Hi,

I’m really new to Processing but starting to get into it. Currently I’m stuck trying to export my sketch. I’m using three libraries: opencv, processing video and java.awt. The sketch is supposed to start the built in webcam (OS Mojave). The app crashes on startup and shows the following message:

> Cannot load GStreamer plugins from /Users/…/sketch\_190213a/application.macosx64/sketch\_190213a.app/Contents/Java//plugins
> 
> The capture plugin does not support device query!
> 
> java.lang.RuntimeException: There are no capture devices connected to this computer.

Thanks in advance!

My full code (because I’m lost…)

```auto
import gab.opencv.*;
import processing.video.*;
import java.awt.*;

int number = 1;
int wasCaptured = 0;
String rawSlice = "rawslice/";
String newSlice = "newslice/";
String systemStatus;
int c1 = color(2, 71, 254);
int c2 = color(255);
boolean keyDelay = false;
long lastTime = 0;

PImage slice, capturedImage, gray, dst, polySlice, drawNewSlice;

ArrayList<Contour> contours;
ArrayList<Contour> polygons;
Capture video;
OpenCV face;
OpenCV opencv;

void settings() {
  size(1080, 480);
}

void setup() {
  size(1080, 480);
  video = new Capture(this, 640/2, height/2);
  face = new OpenCV(this, 640/2, height/2);
  face.loadCascade(OpenCV.CASCADE_FRONTALFACE);
  background(c1);
  lastTime = millis(); 

  video.start();
}

void draw() {
  scale(2);
  face.loadImage(video);
  image(video, 0, 0 );

  noFill();
  stroke(0, 0, 255);
  strokeWeight(2);
  Rectangle[] faces = face.detect();

  for (int i = 0; i < faces.length; i++) {
    if (faces.length > 0 && faces[i].height <= 115 && faces[i].height >= 75) {
      rectMode(CORNER);
      rect(faces[i].x, faces[i].y, faces[i].width, faces[i].height);
      slice = get(faces[i].x * 2, faces[i].y * 2, faces[i].width * 2, faces[i].height * 2);
    }
    
    //feedback face detection
    rectMode(CENTER);
    fill(c1);
    noStroke();
    rect(320/2, 5, 100, 10);
    if (faces.length > 0 && faces[i].height >= 115) {
      systemStatus = "Too close to camera";
    } else if (faces.length > 0 && faces[i].height <= 75) {
      systemStatus = "Too far from camera";
    } else {
      systemStatus = "Face detected";
    }
    textAlign(CENTER);
    fill(c2);
    textSize(6);
    text(systemStatus, 320/2, 6, 100, 10);
  }
  
    if (wasCaptured >= 1) {
      drawPoly();
    } else {
      println("No image selected");
    }
    
    if (millis() - lastTime > 1000 && keyDelay == true) {
      keyDelay = false;
    }
  
    println("Number = " + number + keyDelay);
}

void captureEvent(Capture c) {
  c.read();
}

void keyPressed() { // Create slice on keypress
  if (key == ' ' && keyDelay == false) {
    captureAndSave();
    capturedImage = loadImage(rawSlice + "rawSlice" + nf(number - 1, 1) + ".png");
    wasCaptured++;
    keyDelay = true;
    lastTime = millis();
  } else if (key == ' ' && keyDelay == true) {
    println("Please wait...");
  }

  if (key == 'r') {
    wasCaptured = 0;
    background(c1);
  }
}

void captureAndSave() { // Save slice and iterate
  slice.save(rawSlice + "rawSlice" + nf(number, 1) + ".png");
  number++;
}

void captureNewSlice() {
  polySlice = get(640, 15, 440, 440);
  polySlice.save(newSlice + "newSlice" + nf(number - 1, 1) + ".png");
  delay(50);
}

void drawPoly() {
  opencv = new OpenCV(this, capturedImage);
  opencv.gray();
  opencv.threshold(90);
  gray = opencv.getSnapshot();
  dst = opencv.getOutput();
  //image(gray, 325, 15, 200, 200); // Actual slice

  contours = opencv.findContours();
  println("found " + contours.size() + " contours");

  //image(dst, 325, 15, 200, 200); // Opencv slice

  noFill();
  strokeWeight(2);

  scale(0.8);
  translate(425, 40);
  for (Contour contour : contours) {
    //contour.draw();

    beginShape();
    stroke(c2);
    for (PVector point : contour.getPolygonApproximation().getPoints()) {
       vertex(point.x, point.y);
    }
    endShape();
  }
  
  captureNewSlice();
}

```

---

<div class="post-metadata">

### Author: ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)
#### Post date: [March 12, 2019, 1:22pm UTC](https://discourse.processing.org/t/exporting-sketch-crash-on-startup-mac/9230/2 "2019-03-12T13:22:29Z")

</div>

what export settings you used?  
more:  
[https://github.com/processing/processing/wiki/Export-Info-and-Tips](https://github.com/processing/processing/wiki/Export-Info-and-Tips) ,

---

<div class="post-metadata">

### Author: ![has\_sanity](https://avatars.discourse-cdn.com/v4/letter/h/e0b2c6/32.png) [@has\_sanity](https://discourse.processing.org/u/has_sanity)
#### Post date: [March 12, 2019, 1:23pm UTC](https://discourse.processing.org/t/exporting-sketch-crash-on-startup-mac/9230/3 "2019-03-12T13:23:36Z")

</div>

I exported for Mac OS and Embedded Java. Didn’t change anything else

---

<div class="post-metadata">

### Author: ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)
#### Post date: [March 12, 2019, 1:26pm UTC](https://discourse.processing.org/t/exporting-sketch-crash-on-startup-mac/9230/4 "2019-03-12T13:26:43Z")

</div>

did you ever export and run a  
5 line sketch ( no libraries… )?

---

<div class="post-metadata">

### Author: ![has\_sanity](https://avatars.discourse-cdn.com/v4/letter/h/e0b2c6/32.png) [@has\_sanity](https://discourse.processing.org/u/has_sanity)
#### Post date: [March 12, 2019, 1:29pm UTC](https://discourse.processing.org/t/exporting-sketch-crash-on-startup-mac/9230/5 "2019-03-12T13:29:11Z")

</div>

Yeah, they just run fine

---

<div class="post-metadata">

### Author: ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)
#### Post date: [March 12, 2019, 1:31pm UTC](https://discourse.processing.org/t/exporting-sketch-crash-on-startup-mac/9230/6 "2019-03-12T13:31:32Z")

</div>

> [@has\_sanity](#):
>
> /sketch\_190213a/application.macosx64/sketch\_190213a.app/Contents/Java//plugins

can you check on that directories pls,  
i worry the “//”  
is that possible on MAC

---

<div class="post-metadata">

### Author: ![has\_sanity](https://avatars.discourse-cdn.com/v4/letter/h/e0b2c6/32.png) [@has\_sanity](https://discourse.processing.org/u/has_sanity)
#### Post date: [March 12, 2019, 1:33pm UTC](https://discourse.processing.org/t/exporting-sketch-crash-on-startup-mac/9230/7 "2019-03-12T13:33:45Z")

</div>

I noticed that aswell. It shouldn’t be a thing but I don’t know why there’s two slashes…  
I also don’t know how I could change that (or if thats even possible)

Thanks for trying though: bear with me as I try to understand and keep up.

---

<div class="post-metadata">

### Author: ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)
#### Post date: [March 12, 2019, 1:35pm UTC](https://discourse.processing.org/t/exporting-sketch-crash-on-startup-mac/9230/8 "2019-03-12T13:35:37Z")

</div>

hope the MAC specialists can jump in

---

<div class="post-metadata">

### Author: ![has\_sanity](https://avatars.discourse-cdn.com/v4/letter/h/e0b2c6/32.png) [@has\_sanity](https://discourse.processing.org/u/has_sanity)
#### Post date: [March 12, 2019, 1:36pm UTC](https://discourse.processing.org/t/exporting-sketch-crash-on-startup-mac/9230/9 "2019-03-12T13:36:43Z")

</div>

I’ve read somewhere that it _could_ be a 32/64bit issue. But how to fix it; that I didn’t find.

Thanks anyway @kll

---

<div class="post-metadata">

### Author: ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)
#### Post date: [March 12, 2019, 1:37pm UTC](https://discourse.processing.org/t/exporting-sketch-crash-on-startup-mac/9230/10 "2019-03-12T13:37:53Z")

</div>

old but good info:  
[https://forum.processing.org/one/topic/exporting-application-with-gstreamer.html](https://forum.processing.org/one/topic/exporting-application-with-gstreamer.html)

---

<div class="post-metadata">

### Author: ![has\_sanity](https://avatars.discourse-cdn.com/v4/letter/h/e0b2c6/32.png) [@has\_sanity](https://discourse.processing.org/u/has_sanity)
#### Post date: [March 12, 2019, 1:40pm UTC](https://discourse.processing.org/t/exporting-sketch-crash-on-startup-mac/9230/11 "2019-03-12T13:40:34Z")

</div>

Mhmmm… The ‘gstreamer-java.jar’ file was exported correctly though, its in the contents. Could it still be missing parts?

---

<div class="post-metadata">

### Author: ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)
#### Post date: [March 16, 2019, 7:57pm UTC](https://discourse.processing.org/t/exporting-sketch-crash-on-startup-mac/9230/12 "2019-03-16T19:57:37Z")

</div>

Were you able to resolve this issue?

Just to confirm: this is a problem with exporting the Processing Video library on the same machine with the same camera – you are able to run the sketch in PDE and it runs fine with video, but when you export and run on the same laptop it fails. Is that right?

You may need debugging advice from video library gurus.

---

<div class="post-metadata">

### Author: ![has\_sanity](https://avatars.discourse-cdn.com/v4/letter/h/e0b2c6/32.png) [@has\_sanity](https://discourse.processing.org/u/has_sanity)
#### Post date: [March 18, 2019, 1:31pm UTC](https://discourse.processing.org/t/exporting-sketch-crash-on-startup-mac/9230/13 "2019-03-18T13:31:34Z")

</div>

> able to run the sketch in PDE and it runs fine with video, but when you export and run on the same laptop it fails. Is that right?

Exactly right.

Have not been able to fix it yet…

---

<div class="post-metadata">

### Author: ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)
#### Post date: [March 18, 2019, 3:47pm UTC](https://discourse.processing.org/t/exporting-sketch-crash-on-startup-mac/9230/14 "2019-03-18T15:47:16Z")

</div>

I’m not sure why that would be happening. Sounds like we need some video library / GStreamer experts to weigh in on this.

Perhaps @hamoid has a suggestion for how to start debugging…?

---

<div class="post-metadata">

### Author: ![hamoid](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/hamoid/32/58_2.png) [@hamoid](https://discourse.processing.org/u/hamoid)
#### Post date: [March 18, 2019, 4:04pm UTC](https://discourse.processing.org/t/exporting-sketch-crash-on-startup-mac/9230/15 "2019-03-18T16:04:24Z")

</div>

I don’t own a Mac, but the first thing I would try is to make a minimal program that shows this issue. Maybe the video playback example that comes with the library shows this problem already when exported as an application?

ps. @neilcsmith is the gstreamer expert here 🙂

---

<div class="post-metadata">

### Author: ![has\_sanity](https://avatars.discourse-cdn.com/v4/letter/h/e0b2c6/32.png) [@has\_sanity](https://discourse.processing.org/u/has_sanity)
#### Post date: [March 18, 2019, 4:27pm UTC](https://discourse.processing.org/t/exporting-sketch-crash-on-startup-mac/9230/16 "2019-03-18T16:27:53Z")

</div>

I have tried setting up a minimal program and exporting it. I can successfully export a program that includes the opencv and video capture library (and the facial recognition works).

Could the _contour_ function from opencv be the one causing the problem?

---

<div class="post-metadata">

### Author: ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)
#### Post date: [March 18, 2019, 4:49pm UTC](https://discourse.processing.org/t/exporting-sketch-crash-on-startup-mac/9230/17 "2019-03-18T16:49:10Z")

</div>

Thanks @hamoid 😜

That plugin error message in the first post definitely looks suspect, particularly with the empty folder name `Java//plugins`. I do wish the Video library just went with a system installed version of GStreamer - be so much easier! The way the code currently looks I don’t think it’s even easily possible to set it to use one.

You might want to look at Video library v2 and see if that’s any better. At least anything with `gstreamer-java` rather than `gst1-java-core` in it has not been supported for years!

---

<div class="post-metadata">

### Author: ![hamoid](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/hamoid/32/58_2.png) [@hamoid](https://discourse.processing.org/u/hamoid)
#### Post date: [March 18, 2019, 4:57pm UTC](https://discourse.processing.org/t/exporting-sketch-crash-on-startup-mac/9230/18 "2019-03-18T16:57:21Z")

</div>

Is this related?

> <https://github.com/processing/processing-video/issues/80>

With v2 you mean the one that can be downloaded here, right?

> **[processing/processing-video](https://github.com/processing/processing-video/releases)**
>
> Contribute to processing/processing-video development by creating an account on GitHub.

Have you with tried v2, @has_sanity ?

---

<div class="post-metadata">

### Author: ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)
#### Post date: [March 18, 2019, 4:59pm UTC](https://discourse.processing.org/t/exporting-sketch-crash-on-startup-mac/9230/19 "2019-03-18T16:59:18Z")

</div>

Yes, although that’s also a bit old - we’re about to release gst1-java-core v1 which has a lot of fixes in it. I’m hopeful someone will pick up the Processing Video library for GSoC!

A key change since the Video library was first written is that the GStreamer project now releases Mac and Windows installers which makes things far easier if you don’t need to bundle the library for any reason. I think that should be the default for Processing. I just checked the v2 code though and it’s doing things to explicitly disable a system install except on Linux.

---

<div class="post-metadata">

### Author: ![has\_sanity](https://avatars.discourse-cdn.com/v4/letter/h/e0b2c6/32.png) [@has\_sanity](https://discourse.processing.org/u/has_sanity)
#### Post date: [March 18, 2019, 5:15pm UTC](https://discourse.processing.org/t/exporting-sketch-crash-on-startup-mac/9230/20 "2019-03-18T17:15:06Z")

</div>

Just really quickly tried (have to be somewhere lol) and got this. Idk if it’s because of changes to the library which I missed, but posting it regardless because I’m lost.

```auto
(Processing core video:7346): GLib-GObject-WARNING **: cannot register existing type 'gchar'
**
GLib-GObject:ERROR:gvaluetypes.c:457:_g_value_types_init: assertion failed: (type == G_TYPE_CHAR)
Could not run the sketch (Target VM failed to initialize).
For more information, read revisions.txt and Help → Troubleshooting.

```

@hamoid @neilcsmith  
It’s not really a must to find a fix for this, but it’d be really sick if there is a fix for it. I’m using it for an art project (uni), being able to export it properly would just make a few things easier. Thanks already though
