“Unresolved compilation problems” from running MPJ express in Eclipse Indigo

ぐ巨炮叔叔 提交于 2019-12-10 16:27:48

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/8037871/unresolved-compilation-problems-from-running-mpj-express-in-eclipse-indigo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!