- Timestamp:
- 03/01/06 17:13:31 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/org.modelica.mdt.omc/src/org/modelica/mdt/omc/OMCProxy.java
r380 r393 190 190 private static void startServer() throws ConnectException 191 191 { 192 String pathToOmc = null;192 String[] pathsToOmc = new String[3]; 193 193 File workingDirectory; 194 194 … … 208 208 if(os.equals("Unix")) 209 209 { 210 pathToOmc = omHome + "/bin/omc"; 210 pathsToOmc[0] = omHome + "/bin/omc"; 211 pathsToOmc[1] = omHome + "/omc"; 212 pathsToOmc[2] = omHome + "/Compiler/omc"; 211 213 } 212 214 else if(os.equals("Windows")) 213 215 { 214 pathToOmc = omHome + "\\bin\\omc.exe"; 216 pathsToOmc[0] = omHome + "\\bin\\omc.exe"; 217 pathsToOmc[1] = omHome + "\\omc.exe"; 218 pathsToOmc[2] = omHome + "\\Compiler\\omc.exe"; 215 219 } 216 220 … … 230 234 } 231 235 232 String command[] = { pathToOmc, "+d=interactiveCorba" }; 233 try 234 { 235 logOMCStatus("Running command " + command[0] + " " + command[1]); 236 Runtime.getRuntime().exec(command, null, workingDirectory); 237 logOMCStatus("Command run successfully."); 238 } 239 catch(IOException e) 240 { 241 /* 242 * If we fail to start the compiler, maybe the executable is in 243 * the Compiler directory (if we've compiled the compiler from 244 * source). Try starting OMC from this secondary location. 245 */ 246 logOMCStatus("Error running command " + e.getMessage() 247 + ", trying alternative path to the binary."); 248 String secondaryPathToOmc = null; 236 for(int i = 0;i < 3;i++) 237 { 238 String command[] = { pathsToOmc[i], "+d=interactiveCorba" }; 249 239 try 250 240 { 251 if(os.equals("Unix")) 252 { 253 secondaryPathToOmc = omHome + "/build/bin/omc"; 254 } 255 else if(os.equals("Windows")) 256 { 257 secondaryPathToOmc = omHome + "\\build\\bin\\omc.exe"; 258 } 259 260 command = 261 new String[]{secondaryPathToOmc, "+d=interactiveCorba"}; 262 logOMCStatus("Running command " 263 + command[0] + " " + command[1]); 241 logOMCStatus("Running command " + command[0] + " " + command[1]); 264 242 Runtime.getRuntime().exec(command, null, workingDirectory); 265 243 logOMCStatus("Command run successfully."); 266 } 267 catch(IOException ex) 268 { 269 logOMCStatus("Unable to start OMC, giving up."); 270 throw new ConnectException 271 ("Unable to start the OpenModelica Compiler. " 272 + "Tried starting " + pathToOmc 273 + " and " + secondaryPathToOmc); 274 } 244 245 break; /* exit the for loop, we've started OMC */ 246 } 247 catch(IOException e) 248 { 249 if(i < 2) 250 { 251 logOMCStatus("Error running command " + e.getMessage() 252 + ", trying alternative path to the binary."); 253 254 /* If the call failed, try another path to the compiler */ 255 } 256 else 257 { 258 /* If all the paths to OMC were wrong, throw an exception */ 259 260 logOMCStatus("Unable to start OMC, giving up."); 261 throw new ConnectException 262 ("Unable to start the OpenModelica Compiler. " 263 + "Tried starting " + pathsToOmc[0] + ", " 264 + pathsToOmc[1] + " and " + pathsToOmc[2]); 265 } 266 } 275 267 } 276 268
Note: See TracChangeset
for help on using the changeset viewer.