For Java Programmers: Executing External Applications, Accessing Web Resources and Initiating Browser Redirection from Java Code
By Werner Ruotsalainen, Submitted Friday, January 20, 2006
Topics:
http://smartphonemag.com/forum/topic.asp?TOPIC_ID=20454
(Also see this question) A common question from Java programmers is whether you can execute an external application from a Java self-standing application (that is, not an applet) on the Pocket PC. In this article, I scrutinize this question, along with the Pocket PC support of applets communicating with applications on the originating host and redirecting the browser to another page. The short answer to the first question is: no. The long answer is as follows: I've tested all the current (or, with Jeode, the latest available) Java Virtual Machine versions with an application that should have started Pocket Excel (application class file, compiled with JDK 1.1 so that even Jeode can load it, here; source here and JAR file with the class here). The test results are as follows:- CrEme 4.00 beta: doesn't work
- Mysaifu 1.0.9: doesn't work The error message shown (note that the current version of Mysaifu likes referring to the user class to be missing (ClassNotFoundException) when some of the related classes/their method are missing; in this case, the situation is the same): java.lang.ClassNotFoundException: Execute not found in java.lang.ClassLoader$1{urls=[file:/e.jar], parent=null} at java.net.URLClassLoader.findClass (URLClassLoader.java:870) at java.lang.ClassLoader.loadClass (ClassLoader.java:342) at java.lang.ClassLoader$1.loadClass (ClassLoader.java:1110) at java.lang.ClassLoader.loadClass (ClassLoader.java:294) at java.lang.VMMainThread$1.run (VMMainThread.java:96) at java.lang.VMThread.run (VMThread.java:120) JVM exit.
- IBM J9 PE: doesn't work The error message shown: (W)J9VM0013 Initialization error in function VMInitStages: (E)J9VM0009 J9VMDllMain failed (E)EXEX0013 Internal VM error: Failed to create Java VM (I)EXEX0014 Run -help for usage
- the latest, version 1.9.3 Esmertec Jeode JVM (no longer directly sold): doesn't work (another screenshot scrolled to the right so that you can see the rest of the Exception report is here).
- Werner Ruotsalainen's blog
- Login to post comments
Printer-friendly version




Give a try to Thunderhawk. Unfortunately, the "traditional" (Jeode/CrEme) PIE plug-ins are both 1.3 only.
"Does anybody know if there's a small .NET- or Win32-App for PPC which like runs a socket which takes the path of an application and executes the application it?"
What did you mean by "runs a socket"? Simply executing an external application? Or, does it listen to incoming TCP/IP requests by keeping a server socket open?
If plain execution is what you meant, you may also want to give a try to nScriptm, a free, great scripting solution for the Pocket PC. I've published some examples of using it to execute external applications here and here.
Java is too heavy-weight for this task, RAM/CPU usage-wise. Besides, it doesn't seem to work.
The best wayt to do this is either native eVC or .NET.
If you, however, want to give nScriptm a try (so that you can avoid using the much more complicated eVC or purchasing isual Studio). It supports both server socket listening and conditional execution - as with any decent programming language/function library. See http://s-k-tools.com/freeware/nsen.txt for more information.
"I have to put my code in a file with
the extension "ns", right? And I
have to register the extension "ns"
with the registry before..."
You can register the .ns extension in the Registry (by using Resco Explorer or MyExtension) - but you don't have to. You can just create a direct link to ns.exe, passing the .ns file as parameter to be executed.