2 * @author Walther Neuper
3 * Created on Mar 30, 2017
4 * (c) due to copyright terms
9 import java.io.FileNotFoundException;
10 import java.io.IOException;
11 import java.io.InputStream;
12 import java.nio.file.Paths;
13 import java.util.Properties;
15 import edu.tum.cs.isabelle.api.Configuration;
16 import edu.tum.cs.isabelle.api.Environment;
17 import edu.tum.cs.isabelle.api.Version;
18 import edu.tum.cs.isabelle.japi.JPlatform;
19 import edu.tum.cs.isabelle.japi.JSetup;
20 import edu.tum.cs.isabelle.japi.JSystem;
21 import edu.tum.cs.isabelle.setup.Setup;
24 * Connect tests with Isac's mathematics engine.
26 public class Isabelle_Isac {
28 public static JSystem connect() {
29 String isabelle_home_ = "";
30 InputStream inputStream = null;
32 Properties prop = new Properties();
33 String propFileName = "./properties/BridgeMain.properties";
34 inputStream = Isabelle_Isac.class.getClassLoader().getResourceAsStream(propFileName);
35 if (inputStream != null) {
36 prop.load(inputStream);
38 throw new FileNotFoundException("property file '" + propFileName + "' not found in the classpath");
40 // get the property value and print it out
41 isabelle_home_ = prop.getProperty("ISABELLE_HOME");
42 } catch (Exception e) {
43 System.out.println("Exception: " + e);
45 try { inputStream.close();
46 } catch (IOException e) { e.printStackTrace(); }
48 Setup setup = new Setup(Paths.get(isabelle_home_), JPlatform.guess(),
49 new Version("2015"), Setup.defaultPackageName());
50 Environment env = JSetup.makeEnvironment(setup); // without Duration
51 Configuration config = Configuration.fromBuiltin("libisabelle_Isac");
52 return JSystem.create(env, config);