
import os
from . import _orekit

__module_dir__ = os.path.abspath(os.path.dirname(__file__))

class JavaError(Exception):
  def getJavaException(self):
    return self.args[0]
  def __str__(self):
    writer = StringWriter()
    self.getJavaException().printStackTrace(PrintWriter(writer))
    return "\n".join((str(super(JavaError, self)), "    Java stacktrace:", str(writer)))

class InvalidArgsError(Exception):
  pass

_orekit._set_exception_types(JavaError, InvalidArgsError)

VERSION = "9.3.1"
CLASSPATH = [os.path.join(__module_dir__, "orekit-9.3.1.jar"), os.path.join(__module_dir__, "hipparchus-core-1.4.jar"), os.path.join(__module_dir__, "hipparchus-filtering-1.4.jar"), os.path.join(__module_dir__, "hipparchus-fitting-1.4.jar"), os.path.join(__module_dir__, "hipparchus-geometry-1.4.jar"), os.path.join(__module_dir__, "hipparchus-ode-1.4.jar"), os.path.join(__module_dir__, "hipparchus-optim-1.4.jar"), os.path.join(__module_dir__, "hipparchus-stat-1.4.jar")]
CLASSPATH = os.pathsep.join(CLASSPATH)
_orekit.CLASSPATH = CLASSPATH
_orekit._set_function_self(_orekit.initVM, _orekit)

from ._orekit import *
from java.io import PrintWriter, StringWriter
