Use inside an exported jar file

i am new to using orekit and facing a very basic problem.
I am currently using the orekit library in my software but I am facing issues with integrating the file into the exported jar file. I am using the ZipJarCrawler to add the data to the dataprovidermanager but this does not seem to work. The zip file is placed inside the src folder in my eclipse project and works fine from within the ide but as soon as I export it as a jar and try to run it I get an exception that says

Caused by: java.lang.NullPointerException
at org.orekit.frames.TopocentricFrame.(

Here is my code.

URL url =
DataProvidersManager manager = DataProvidersManager.getInstance();
manager.addProvider(new ZipJarCrawler(new File(url.toURI().getPath())));
Frame earthFrame = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
GeodeticPoint geodeticP = new GeodeticPoint(latitude, longitude, altitude); // Create location point
// Topocentric frame for the ground station.
TopocentricFrame station = new TopocentricFrame(earth, geodeticP, stationName);

Can someone help me out?


Hi @saiprasadbarke,

Welcome to the Orekit community !

I think the problem comes from the line:

URL url = FileUtils.class.getClassLoader().getResource("/src/");

I am not a specialist of jar production but here you’re using a relative path that your IDE understands but that the jar does not know.
I would suggest you to not try to embark the “orekit-data” in the jar, since you may want to update the data later without recompiling the project.
A common way is to put the “orekit-data” in a separate directory (your home directory for example) and use something like:

File home       = new File(System.getProperty("user.home"));
File orekitData = new File(home, "");
DataProvidersManager manager = DataProvidersManager.getInstance();
manager.addProvider(new ZipJarCrawler(orekitData));

There are some examples of this in the tutorials, like this one on propagation.

Now if you really want to have the orekit-data into the jar you’ll have to wait for someone more knowledgeable than me to answer :slight_smile:


Hello Maxime,

Thank you for your idea. I can still use that as an alternative in the meantime.

I would not recommend embedding the inside a jar, and even not recommend to use it directly.
The first reason is that the zip/jar archive file format exhibit an overhead when extracting small files from big archives, as the central directory that describes the file structure is at the end of the archive. So for example in orekit-data, even if you only need to access the 41 lines text file tai-utc.dat and even if it is at the start of the archive, you will need to parse the complete multi-megabytes archive to reach the central directory. This will happen for all files you extract from it (and there are several hundred of small files in the MSAFE sub-folder in the archive). The archive is big because in addition to these numerous small files, it contains also four bigger files, the JPL ephemerides, the Earth gravity field, the Earth Orientation parameters for IAU-1980 and the Earth Orientation Parameters for the IAU-2000. The file is intended only as a way to distribute these hundreds of files easily, but users are expected to extract the content in some directory on their computer (or server, or phone, or whatever) and load only the files they need without being forced to skip through millions of bytes that will be ignored at the end.

The second reason for avoiding use of the zip archive is that orekit-data contains data that must be updated from time to time. The more stringent example are the Earth Orientation Parameters that are updated by IERS every week (either by completing the big finals.all and finals2000A.all files or by adding new small files like Bulletin A). Updating these data within a zip archive is a pain. It is much easier to updated the files in a folder on a regular file system.

Anyway, if your use case is really to embed the data within your code, the key is to make sure the classpath of your application does contain the data. This is done either by putting the archive at the top of the jar (maven copies it automatically everything that is in the src/resources folder there for you), or by adding a separate jar in addition to the application jar and set up a launcher script so it launches the java virtual machine with both the application jar and the data jar (see the option -classpath in the java command line). Once again, beware in this case that your application will only use data that will quickly become out of date.

1 Like

Hello Luc,

is it possible to download the specific files from the internet using NetworkCrawler? I can easily download the using the NetworkCrawler but this creates a significant overhead every time the application is run.