javampimpj-express

"Unresolved compilation problems" from running MPJ express in Eclipse Indigo


I followed a tutorial from Utube on how to run parallel aplications using MPJ Express in an IDE. I downloaded the latest version of MPJ Express and used Eclipse Indigo.

I did include in my project JAR file for MPI. When I tried to compile a simple "hello program," I got this error:

Caused by: java.lang.Error: Unresolved compilation problems: The type mpi.MPIException cannot be resolved. It is indirectly referenced from required .class files

My code is

import mpi.*;

public class HelloEclipsWorld {
    public static void main(String[] args) throws Exception {
        MPI.Init(args);
        int rank = MPI.COMM_WORLD.Rank();
        int size = MPI.COMM_WORLD.Size();
        System.out.println("I am process < " + rank + " > of total < " +
          size + " > processes.");
        MPI.Finalize();
    }
}

What am I doing wrong?


Solution

  • This looks like a classpath error. Based on your edit, it looks like you're using Eclipse. When you right-click on your project, select Build Path > Configure Build Path... and then go to the "Libraries" (or "Order and Export") tab, you should see mpj.jar. I'm guessing it won't be there, and you'll need to add it.

    This is not the same as mpi.jar, which you said you have. I just set up a simple test project using the code you provided and mpj.jar (downloaded from here), and everything works.