launch() won't launch my compiled processing sketch

edited February 2018 in How To...

One of my Processing scripts has launch("D:\Projects\application.windows64/mysketch.exe"). The .exe is a compiled Processing sketch.

I have tried calling both 32 and 64 bit version of the application, but it still won't work. Double-clicking the file opens it and runs it beautifully.

I have tried with other compiled sketches as well, but still nothing. No error messages are displayed, and I have verified that the path is correct.

Does anyone have any suggestions? I have also tried using \ instead of / in the path.

Tagged:

Answers

  • This took me a bit closer I think, but I can't seem to find any reference for exec(). When trying exec("file") I'm getting this error block:

    button1 - GButton >> GEvent.CLICKED @ 4895

    ########## EXCEPTION IN EVENT HANDLER

    An error occured during execution of the eventhandler: CLASS: TrackerGUI METHOD: button1_click1 Caused by java.lang.RuntimeException: Could not open Tracker.exe processing.core.PApplet.exec(PApplet.java:3506) TrackerGUI.buttonClick(TrackerGUI.java:57) TrackerGUI.button1_click1(TrackerGUI.java:92) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) g4p_controls.GAbstractControl.fireEvent(Unknown Source) g4p_controls.GButton.mouseEvent(Unknown Source) g4p_controls.GWindowImpl.mouseEvent(Unknown Source) sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) processing.core.PApplet$RegisteredMethods.handle(PApplet.java:1427) processing.core.PApplet.handleMethods(PApplet.java:1622) processing.core.PApplet.handleMouseEvent(PApplet.java:2685) processing.core.PApplet.dequeueEvents(PApplet.java:2607) processing.core.PApplet.handleDraw(PApplet.java:2448) processing.awt.PSurfaceAWT$12.callDraw(PSurfaceAWT.java:1557) processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:316)

    #
  • I can't seem to find any reference for exec()

    It is in the JavaDoc, not the public reference:

  • edited February 2018

    Flipping the slashes didn't do it for me, neither did using the full path. I'm already using the writer to make a .txt, so I don't think I can use it to make a .bat as well?

    I also tried running both Processing and the compiled sketch as admin, but it didn't help either.

    EDIT: For those seeing the link above, the .bat can obviously be made in advance, and be run using exec() or launch(). @kfrajer's answer contains the suggested code - cd to to the directory and use start sketch.exe

  • Ok, I did a demo here just recently: https://forum.processing.org/two/discussion/comment/118012/#Comment_118012

    Just to add, it seems exec() is not able to launch an application. On the other hand, launch() did it but you have to call it from a batch file (.bat extension)

    Kf

  • So I made a .bat file with start mySketch.exe, which successfully runs my application. But when I try to use exec("runSketch.bat") or launch("runSketch.bat") I get a windows-error: "Cannot find mySketch.exe...". This happened when I used the short path, as the .exe is located in the same folder as the .bat, and the .pde

    When using the full path in the .bat nothing happens, like it hasn't been executed, or that it closes immediately (nothing shown on screen).

  • edited February 2018

    Apparently, doing 'start "mySketch.exe" gives me a prompt in CMD. Maybe there is a path or parameter I need to pass?

    EDIT: The CMD opens in the folder I have Processing installed, and not from where the .bat is run. Help?

  • Answer ✓

    From the example I provided in my most recent link, I did this:

    launch(sketchPath("")+"runSketch.bat");

    This assumes the bat file is in your sketch folder. Within the bat file you should do this:

    cd d:\\folder\\containing\\exec\file
    mySketch.exe
    

    Does this work for you?

    Kf

  • Thank you so much, you beautiful being. I did just this with single \'s, and it worked.

  • Glad to hear!

    I did just this with single \'s

    Sorry, what do you mean?

    Kf

  • e.g. d:\folder\containing\exec\file , no reason to use double slashes in a .bat I think

Sign In or Register to comment.