B4J Question Opening an external app inside the form (or panel)

Cableguy

Expert
Licensed User
Longtime User
Hi Gurus...

Is it possible to open an external app ( B4X ide as an example) inside a B4J form or Pane?
 

DonManfred

Expert
Licensed User
Longtime User
I dont think this will work.
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Oh well, I had to ask!
 
Upvote 0

crt

Member
Licensed User
Longtime User
Huh, you can't do it by running Java code inline, and then do?
B4X:
 Runtime r = Runtime.getRuntime();
        r.exec(exepath + " " + exeargs);

Out of curiosity I have been trying this:
B4X:
Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
    MainForm.Show
    Private nativeMe As JavaObject=Me
    nativeMe.RunMethod("RunFiles",Array("c:\Clock.exe",""))
End Sub

'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
    Return True
End Sub

#If JAVA

import java.io;
import java.lang.Object;


  Public static void RunFiles(String exepath, String exeargs) throws IOException {

    Try {
        Runtime r = Runtime.getRuntime();
        r.exec(exepath +" "+exeargs);
    } Catch (IOException e) {

        e.printStackTrace();
    }
}
#End if

But I keep getting an error "identifier expected" at Public static void RunFiles
 
Last edited:
Upvote 0

crt

Member
Licensed User
Longtime User
Ok, I think I misunderstood the question, you are talking about embedding a window inside the application similar to microsofts OLE embedding.
I apologize for that. I need to stay out of topics I know nothing about.
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
@crt off original topic but
B4X:
Public static void RunFiles(String exepath, String exeargs) throws IOException {
should be
B4X:
public static void RunFiles(String exepath, String exeargs) throws IOException {
looks like you got caught out by the insert a line after #if java line and the case of the code gets changed to match B4X code.
 
Upvote 0
Top