不行……
如果要调用动态链接库,为什么要用JAVA?能调用的程序多了……

解决方案 »

  1.   

    好像是可以的 , 只是调用的方法比较麻烦
    在Linux下 生成 *.so  放到指定目录
    好像使用 JNI 来实现Java对C的调用 , 当然这跟调用C写的动态连接库会有
    差别 ,不过我想是差不多的。
      

  2.   

    既然用JAVA,就应该是考虑跨平台性吧?为什么还要用动态库呢?
      

  3.   

    在Windows上,我们将一些功能模块封装成动态库后,可以供多种语言(C、VB、PB等)所写的程序直接调用。但如果是用Java来开发应用程序,我想知道这些功能模块是否必须用Java重写,所以提出此问题。
      

  4.   

    还是那句话,如果不考虑跨平台,只在WINDOWS下面用,何必用JAVA?
      

  5.   

    还是那句话,如果不考虑跨平台,只在WINDOWS下面用,何必用JAVA?
      

  6.   

    楼上:
     样样野不要那么绝对,举个例子,在linux下,包含awt的java程序如何在没有x-win的环境下运行?你能做的到吗。所以一个办法是用jni调用C写的library去完成awt的功能。
      

  7.   

    这是两回事……难道他在WINDOWS下面的动态库能在LINUX下面用?
      

  8.   

    你能用java取机器的硬件信息吗?
      

  9.   

    楼上:不是这个意思。看看下面吧。
    http://java.sun.com/docs/books/tutorial/native1.1/concepts/index.htmlProgrammers use the JNI to write native methods to handle those situations when an application cannot be written entirely in the Java programming language. For example, you may need to use native methods and the JNI in the following situations: 1。The standard Java class library may not support the platform-dependent features needed by your application. 
    2。You may already have a library or application written in another programming language and you wish to make it accessible to Java applications. 
    3。You may want to implement a small portion of time-critical code in a lower-level programming language, such as assembly, and then have your Java application call these functions.
      

  10.   

    当然会有用JNI的地方,但我怀疑他的程序是否有跨平台的要求?或者是希望能跨平台,但又不想把以前的动态库重写……对了,你用JNI作过东西吗?如果需要跨平台怎么办?
      

  11.   


    java<->jni<->JNI interface 'DLL <->native DLL
      

  12.   

    >回复ender:
    >这是两回事……难道他在WINDOWS下面的动态库能在LINUX下面用? 在Windows上的动态库是用C写的,几乎不需修改就可以在Linux上重新生成.so。所以这里还是想用Java的跨平台性的。
      

  13.   

    哈,原来是这样……那你还是多看看JNI吧……算是长了一点见识了,哈!