-3

I got a IJavaProject and a class in fqnd: "com.example.urgs.ClassName".

How do I figure out if it is in the Project?

edit:

    String value = "com.example.xx.Generator";

    IJavaProject ijp = JavaCore.create(this.getProject(parameterValue));
    try {
        if(ijp.findType(value) == null){
            return error("Generator class does not exist.");
        }
    } catch (JavaModelException e) {
        // Stacktrace
        e.printStackTrace();
    }    

This works for me ;)

edit2: parameterValue can be anything thats in the workspace.

Hugo Boss
  • 11
  • 1

1 Answers1

0

Try to load the class with something like this Class.forName("com.example.urgs.ClassName")

If the class cannot be located throws ClassNotFoundException

Diego D
  • 1,735
  • 3
  • 22
  • 38
  • thx, but I allready tried that :) Its not the actuall workspace where i want to search, its the runtime-workspace of the generated Eclipse-instance. – Hugo Boss Jun 04 '13 at 13:57