문제

I made Desktop app with netbeans platform in java.In my app i using JAI and Java3d. This app i made for dentist. So every installation time doctore do not want to inastall jai, java3D, its like headache for dentist. So i have to check at starting of my app that if JAI and Java3D is installed or not? if not then install JAI and Java3D programetically from my app. So how can i do that?

도움이 되었습니까?

해결책

public class ClassUtils {
  public static boolean isAvailable(String className) {
    boolean isFound = false;
    try {
       Class.forName(className, false, null);
       isFound = true;
    }
    catch (ClassNotFoundException e) {
       isFound = false;
    }
    return isFound;
  }

  public static boolean isJava3dAvailable() {
   return isAvailable("javax.media.j3d.View");
  }

  public static void  main(String args[]) {
    System.out.println ("JAI " +
       (ClassUtils.isAvailable("javax.media.jai.ImageJAI")?"present":"missing"));
    System.out.println ("Java3d " +
       (ClassUtils.isJava3dAvailable()?"present":"missing"));
  }

}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top