#if java
public static void foo() {
try {
@SuppressWarnings("unused")
String command = "c:\\windows\\system32\\net.exe use f: " + x ;
Process p = Runtime.getRuntime().exec(command);
System.out.print("does not = 1");
} catch (Exception name) {
System.out.print("does not = 1");
}}
#End If
Error:
B4X:
src\b4j\example\main.java:216: error: cannot find symbol
String command = "c:\\windows\\system32\\net.exe use f: " + x ;
^
symbol: variable x
location: class main
the Dim x as String is in the Process_Globals. Why cant I use it in the #If Java????
How would I use jShell to do the above? I could not quite figure it out. Sorry this is my first time using b4j.
when I Googled my issue I found a java solution. That is why I did it the way I did.
Dim shl As Shell
shl.Initialize("shl", "c:\windows\system32\net.exe", Array("use", "f:", x))
shl.Run(10000)
Wait For shl_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
If Success AND ExitCode = 0 Then
Log("Success")
Log(StdOut)
Else
Log("Error: " & StdErr)
End If