Hi I have been struggling to get the 'getenv' to work. it will keep on returning "Exception in thread "main" java.lang.UnsupportedOperationException". I have been reading about the ProcessBuilder but i am not quite sure on how and where to implement it based on my code below.
What I want to exactly do is, to set a variable ("REGRESSION_STATUS", "UPDATED") and ("REGRESSION_STATUS", "OUTDATED") when the condition is met, and return the value "UPDATED" and "OUTDATED" as appropriate when executed through the cmd in Windows.
public static void main(String[] args) throws ClassNotFoundException {
String run_type = args[0];
String inputFile = args[1];
System.out.println("RUN TYPE = " + run_type);
System.out.println("INPUT FILE = " + inputFile);
MiniData data = getValue(run_type, "LEM");
if(run_type.equals("BUILD")){
System.out.println("Script = " + data.getScript());
}
else if (run_type.equals("DEPLOY")){
System.out.println("Script = " + data.getScript());
}
else if (run_type.equals("REGRESSION")){
System.out.println("Runtime Version (DB) = " + data.getRuntime());
String file_name =inputFile;
if(data.getRuntime().equals(getRuntimeVersion(file_name)))
{
System.out.println("The version is up-to-date");
System.getenv().put("REGRESSION_STATUS", "UPDATED");
System.getenv().put("REGRESSION_VER", data.getRuntime());
}
else
{
System.out.println("This version is outdated");
System.getenv().put("REGRESSION_STATUS", "OUTDATED");
System.getenv().put("REGRESSION_VER", data.getRuntime() );
}
}
else {
System.out.println("You have not the correct value. Enter either BUILD/DEPLOY/REGRESSION");
}
}
Thanks!