2

Why doesn't this work? Is it blocked in cn1?

Process process = Runtime.getRuntime().exec(command);
ygesher
  • 1,133
  • 12
  • 26
  • 2
    What is not working? What command are you trying to execute? If there is an exception please post it in your question... – brso05 Feb 01 '16 at 18:22
  • 1
    I can't find exec() in their [API docs](https://www.codenameone.com/javadoc/index.html), so there's probably no .exec() method. – nos Feb 01 '16 at 18:25

1 Answers1

0

Devices don't support executing arbitrary applications. Applications running within a mobile device are restricted to their own isolated environment and can't even access files created by different applications without going thru amazing hoops so this will not work on any device.

I'm assuming you are trying to invoke an external app which is something you can't even do in Android, you can however invoke a native app as explained here: Is it possible to invoke other mobile app from a code name one app

By using something like Display.execute.

Community
  • 1
  • 1
Shai Almog
  • 51,749
  • 5
  • 35
  • 65
  • I'm trying to run the code in a native Android class, and the error is coming from the build server error log. – ygesher Feb 02 '16 at 05:47
  • We don't block anything on native here although as I said, its quite wrong to use that API. What's the full error log? – Shai Almog Feb 03 '16 at 04:12
  • This is in the standard code snippet in all the Android examples for gaining access to the logcat through code. The full log is [here](https://s3.amazonaws.com/codenameone-build-response/5b6f70a4-df18-41c4-bcd8-d013d5051f8f-1454350650549-error.txt). – ygesher Feb 03 '16 at 18:01
  • Looking at the log I think your import statements are incorrect and refer to a different Process class than the one from java.*. – Shai Almog Feb 04 '16 at 03:49