- Home /
External .jar and Windows Permissions?
I am part of a programming project building a game that runs a planning AI via an external .jar file. We are using Unity's version of C# as our language within the toolkit itself.
For the sake of simplicity, cleanliness, and user convenience, we are using a piece of code to start the planner AI jar from within the executable when the user initiates a play session.
Within the Windows 7 environment, this only seems to work from less prtected locations like the desktop, or my documents. As soon as we try to install the program to a subdirectory under Program Files, the planner ceases to run when it is called on.
I have tried adding several things to the code to demand administrator priveleges, but this does not seem to fix the problem. We would really like to be able to assure that our end users will be able to run the program regardless of where they choose to install it.
Does anyone have any thoughts as to what the problem might be?
The code I am using to initiate the jar process;
public class bootSceneController : MonoBehaviour {
//Vars
public static Process plannerProcess; //A Process to hold the Planner jar
//StreamWriter myStreamWriter; //An output stream for sending a 'heartbeat' to the planner
//This acts as crash protection: the planner will self-terminate if this stream ever becomes == null
public GameObject planner;
[PrincipalPermission(SecurityAction.Demand, Role = @"BUILTIN\Administrators")] void Awake (){
//Prepare and Activate the ExecutionManager (planner) jar
//Preparation Code
if(bootSceneController.plannerProcess == null){
bootSceneController.plannerProcess = new Process();
bootSceneController.plannerProcess.StartInfo.UseShellExecute = false;
bootSceneController.plannerProcess.StartInfo.CreateNoWindow = true;
bootSceneController.plannerProcess.StartInfo.FileName = "java.exe";
bootSceneController.plannerProcess.StartInfo.Arguments = "-jar "+Application.dataPath + "/Planner/Planner.jar";
bootSceneController.plannerProcess.StartInfo.Verb = "runas";
print (Application.dataPath + "/Planner/Planner.jar");
bootSceneController.plannerProcess.StartInfo.RedirectStandardInput = true;
//Activation Code
try{
bootSceneController.plannerProcess.Start();
print("Planner Starting.");
}catch (System.SystemException e){
print(e.Message);
}
ManagePlanner.planner = bootSceneController.plannerProcess;
}else{
bootSceneController.plannerProcess = bootSceneController.plannerProcess;
print("Planner online already.");
}
}//end of awake
// Update is called once per frame
void Update () {
//Go to next scene on first update
Application.LoadLevel( 2 );
}//end of update
}//end of class