我想传递String s, ArrayList<String> als
并返回
ArrayList<String> als
Run.java
class Run extends SwingWorker<String, Void>
{
private ArrayList<String> als;
private String s;
public Run(String s, ArrayList<String> als) {
this.s = s;
this.als = als;
}
public String doInBackground()
{
return AnotherClass.doSomething(s, als);
}
public void done()
{
try
{
}
catch (Exception ignore)
{
}
}
}
AnotherClass.java
public class AnotherClass{
public static String doSomething(String ipRange, ArrayList<String> nmapPorts) {
//do some stuff with the strings
try{
ProcessBuilder builder = new ProcessBuilder("someexe", "flag", cmds,
"&cd");
builder.redirectErrorStream(true);
Process pr = builder.start();
//do some stuff with the stream.
return aString;
}catch (IOException e){}
}
}