Atitit. 。Jna技术与 解决 java.lang.Error: Invalid memory access

1. 原因与解决1

2. jNA (这个ms sun 的)1

3. Code1

4. 参考2

1. 原因与解决

Timeout::wait  dll 或者other resource load finish...

And retry

2. jNA (这个ms sun 的)

我目前正做着一个相关的项目,说白了JNA就是JNI的替代品,以前用JNI需要编译一层中间库,现在JNA直接调用C的库
JNA的功能和P/Invoke类似,但编写方法与P/Invoke截然不同。JNA没有使用Annotation,而是通过编写一般的Java代码来实现。

P/Invoke是.NET平台的机制。而JNA是Java平台上的一个开源类库,和其他类库没有什么区别。只需要在classpath下加入jna.jar包,就可以使用JNA

JNA提供了一个动态的C语言编写的转发器,可以自动实现Java和C的数据类型映射。你不再需要编写那个烦人的C动态链接库。

当然,这也意味着,使用JNA技术比使用JNI技术调用动态链接库会有些微的性能损失。可能速度会降低几倍。但对于绝大部分项目来说,影响不大。

作者:: 老哇的爪子 Attilax 艾龙,  EMAIL:1466519819@qq.com

转载请注明来源: http://www.cnblogs.com/attilax/

3. Code

public static void inix() throws IniEx {

//while(true)

{

try {

Thread.sleep(5000);

try {

ini_core();

} catch (Exception e) {

ini_core();

}

} catch (InterruptedException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

}

}

private static void ini_core() throws IniEx {

if(userID<=0)

{

try {

} catch (Throwable e) {

throw new RuntimeException(e);

}

if(userID<=0)

throw new IniEx();

}

}

4. 参考

paip.java 调用c++ dll so总结 - attilax的专栏 - 博客频道 - CSDN.NET.html

paip.java c# .net php python调用c++ c dll so windows api 总结 - attilax的专栏 - 博客频道 - CSDN.NET.html

Atitit. 。Jna技术与 解决 java.lang.Error: Invalid memory access的更多相关文章

  1. Atitit.  Exception in thread "main" java.lang.Error: Unresolved compilation problem:

    Atitit.  Exception in thread "main" java.lang.Error: Unresolved compilation problem: 1.1. ...

  2. 解决java.lang.SecurityException: Invalid signature file digest for Manifest main attributes

    解决java.lang.SecurityException: Invalid signature file digest for Manifest main attributes 当项目依赖其他jar ...

  3. org.apache.axis2.AxisFault: java.lang.Error: Unresolved compilation problem:

    原创:转载请注明出处 今天遇到以下一个异常,找了好长时间,就是不知道什么原因, 在网上搜了好多,也没搜到相关的解决方法. 1.异常展示, org.apache.axis2.AxisFault: jav ...

  4. java.lang.Error: Unresolved compilation problems: Syntax error on token "return", delete this token Type mismatch: cannot convert from Init to String

    java.lang.Error: Unresolved compilation problems:   Syntax error on token "return", delete ...

  5. 解决springboot项目请求出现非法字符问题 java.lang.IllegalArgumentException:Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986

    springboot版本: 2.1.5 最近使用springboot搭建了一个App后台服务的项目,开发接口的时候在本机使用postman工具做请求测试,请求返回一直很正常,但是在前端开发使用h5请求 ...

  6. java.lang.Error: java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(Z)V

    有时候出现这种怪异的问题,是由于多个版本的class存在. 比如说:某个java编译成class后,放到classes下面,然后lib目录下,也有这个class所在的jar包,这样就导致classpa ...

  7. java.lang.IllegalAccessError: tried to access method com.google.common.base.Stopwatch.<init>()V from 解决

    在用spark的yarn-cluster模式跑fpgrowth进行频繁项集挖掘的时候,报如下错误: ERROR yarn.ApplicationMaster: User class threw exc ...

  8. hibernate 解决 java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.validator.internal.engine.xxx 这类的问题

    <!-- 解决 java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.validator.intern ...

  9. java.lang.Error: Unresolved compilation problem: 解决方案

    严重: Allocate exception for servlet WX_Interfacejava.lang.Error: Unresolved compilation problem: The ...

随机推荐

  1. 基于Python的交互式访问

    应用迁移中遇到一些有特殊要求的应用,比如需要通过交互生成一些新的config文件,然后启动应用需要依赖于这些文件,这样在构建镜像的时候基本上是没有办法把这些文件固定的,因为他需要根据运行环境去进行动态 ...

  2. Endnote在latex中的应用的两种方法

    从endnote中向latex文档批量插入参考文献的两种方法 一.若是latex模板中参考文献编写的命令是: \begin{thebibliography} \bibitem{lab1}LIU M L ...

  3. Eclipse启动时禁用不必要的验证。

    window>preferences>general>editors>text editors>Annotations,右边的Annotation type里,点选err ...

  4. ylbtech-LanguageSamples-UserConversions(用户定义的转换)

    ylbtech-Microsoft-CSharpSamples:ylbtech-LanguageSamples-UserConversions(用户定义的转换) 1.A,示例(Sample) 返回顶部 ...

  5. 转:一位10年Java工作经验的架构师聊Java和工作经验

    黄勇( 博客),从事近十年的 JavaEE 应用开发工作,现任阿里巴巴公司系统架构师.对分布式服务架构与大数据技术有深入研究,具有丰富的 B/S 架构开发经验与项目实战经验,擅长敏捷开发模式.国内开源 ...

  6. IOS生成证书

    1.生成本地签名文件, 点击此图标,选择证书助理,按照以下步骤生成签名文件,在生成证书时需要导入签名文件生成. 点击继续就能生成签名文件,保存次CSR文件. 2.生成证书 到下面这个页面选择证书的签名 ...

  7. Mapper not initialized. Call Initialize with appropriate configuration.

    System.InvalidOperationException:“Mapper not initialized. Call Initialize with appropriate configura ...

  8. ssm整合(Spring+SpringMVC+Mybatis)

    一.Spring Spring致力于提供一种方法管理你的业务对象.IOC容器,它可以装载bean(也就是我们java中的类,当然也包括service dao里面的),有了这个机制,我们就不用在每次使用 ...

  9. 虚拟机VMware12.0安装centos 6.5+VMware中虚拟机网络模式区分

    之前的步骤一路next,有设置内存大小的根据机器的配置设置一下即可. 需要注意的地方, 下面是对于简化版进行设置的步骤 虚拟机网络模式 1.桥接模式 在桥接模式下,VMware虚拟机里的系统就像是 局 ...

  10. 改动Dialog窗口的类名

     VS2013 的MFC project(project名: MobileLink).想要改动窗口的类名时,发现不是像设置窗口名一样调用一个函数能够实现的. 实现的注意问题,请看凝视. (1) 改 ...