NDK: ant 错误 [javah] Exception in thread "main" java.lang.NullPointerException 多种解决办法

1、错误提示内容

2、ant脚本对应的内容

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <!-- ======================================================================
 3      2016-8-28 下午3:26:45
 4
 5      HellNDK
 6      description
 7
 8      cjy
 9      ====================================================================== -->
10 <project name="HelloNDK" default="BuildAllHeaders">
11     <description>
12             description
13     </description>
14
15     <!-- =================================
16           target: BuildAllHeaders
17          ================================= -->
18     <target name="BuildAllHeaders">
19         <antcall target="BuildGetStringHeader">
20         </antcall>
21         <antcall target="BuildGetIntHeader">
22         </antcall>
23     </target>
24
25     <!-- - - - - - - - - - - - - - - - - -
26           target: depends
27          - - - - - - - - - - - - - - - - - -->
28     <target name="BuildGetStringHeader">
29         <javah destdir="./jni" classpath="./bin/classes/" class="com.example.hellondk.GetString">
30         </javah>
31     </target>
32
33     <!-- - - - - - - - - - - - - - - - - -
34           target: BuildGetIntHeader
35          - - - - - - - - - - - - - - - - - -->
36     <target name="BuildGetIntHeader">
37
38     </target>
39
40
41 </project>

3、解决方案  

    方法(1)

      进行下列步骤:Run -> External Tools -> External Tools Configurations dialog

      在界面中选择jre选项

      选择Run in Same JRE as workspace

      全部完成后,在进行重新编译,一般情况下,问题就可以解决了。要是没有解决,参考方法(2)

      参考来源:http://stackoverflow.com/questions/15032230/cant-load-javah-error-in-eclipse

   方法(2)  在上图界面中,选择Separete JRE,选择一个新的jre。

    如上图所示,我安装了jdk1.8.0_51。选择之后,点击ok确定。然后在重新进行编译,错误应该就会没有了。

    当然,要是你没有安装新的jre,那么安装一个和自己的eclipse版本对应的jdk(记住安装位置),安装好之后,点击上图的Search找到自己安装jdk的位置,导进来就可以了。

时间: 2025-01-13 00:56:56

NDK: ant 错误 [javah] Exception in thread "main" java.lang.NullPointerException 多种解决办法的相关文章

启动hive错误:Exception in thread &quot;main&quot; java.lang.IllegalArgumentException

启动hive错误:Exception in thread "main" java.lang.IllegalArgumentException 2018-03-20 15:19:07 Gethin_H 阅读数 1357更多 分类专栏: Hive 版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/Gethin_H/article/details/79626223 启动hive时报错了

Exception in thread &quot;main&quot; java.lang.NullPointerException

1.在window操作系统上,使用eclipse开发工具从hdfs分布式文件系统上下载文件报空指针异常解决方法: log4j:WARN No appenders could be found for logger (org.apache.hadoop.metrics2.lib.MutableMetricsFactory). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.a

MyEclipse8.5集成Tomcat7时的启动错误:Exception in thread “main” java.lang.NoClassDefFoundError org/apache/commons/logging/LogFactory

今天,安装Tomcat7.0.21后,单独用D:\apache-tomcat-7.0.21\bin\startup.bat启动web服务正常.但在MyEclipse8.5中集成配置Tomcat7后,在MyEclipse启动Tomcat服务则出现如下错误提示: Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactoryat org.apache.catalina.star

【原】MyEclipse8.5集成Tomcat7时启动错误:Exception in thread “main” java.lang.NoClassDefFoundError

解决方法: MyEclipse->Window->Preferences->MyEclipse->Servers->Tomcat->Tomcat 6.x->Laucch->Create Launch Configuration->Classpath->Bootstrap Entities->Add External JARs->选择并填加tomcat的安装路径,比如:D:\Java\tomcat\bin\tomcat-juli.jar

Exception in thread &quot;main&quot; java.lang.NullPointerException at Class.main

出现这种问题,可能的原因之一可能是对象数组未初始化. Class[] class = new Class[N]; for(int i = 0; i < N; i++){ class[i] = new Class(); } 原文地址:https://www.cnblogs.com/tenghaoxiang/p/10084359.html

Java中调用c/c++语言出现Exception in thread &quot;main&quot; java.lang.UnsatisfiedLinkError: Test.testPrint(Ljava/lang/String;)V...错误

错误: Exception in thread "main" java.lang.UnsatisfiedLinkError: Test.testPrint(Ljava/lang/String;)V at Test.testPrint(Native Method) at Test.main(Test.java:8) 解决方法: 昨天一天都在想办法解决这个问题,操作步骤按照教程来的,怎么会出错呢?想了半天,觉得还是dll文件生成的不对.所以,最后决定把codeblocks换成visual

Hbase delete遇到的常见异常: Exception in thread &quot;main&quot; java.lang.UnsupportedOperationException

hbase 执行批量删除时出现错误: Exception in thread "main" java.lang.UnsupportedOperationException at java.util.AbstractList.remove(AbstractList.java:161) at org.apache.hadoop.hbase.client.HTable.delete(HTable.java:852) 这种异常其实很常见,remove操作不支持,为什么会出现不支持的情况呢?检查

Exception in thread &quot;main&quot; java.lang.NoSuchMethodError: org.testng.TestNG.configure(Lorg/testng/CommandLineArgs;)V

TestNG运行时报以下错误: Exception in thread "main" java.lang.NoSuchMethodError: org.testng.TestNG.configure(Lorg/testng/CommandLineArgs;)V at org.testng.remote.AbstractRemoteTestNG.configure(AbstractRemoteTestNG.java:77) at org.testng.remote.RemoteTestN

Exception in thread &quot;main&quot; java.lang.NoClassDefFoundError: org/jaxen/NamespaceContext

使用dom4j的xpath查询节点,报如下错误: Exception in thread "main" java.lang.NoClassDefFoundError: org/jaxen/NamespaceContext at org.dom4j.DocumentFactory.createXPath(DocumentFactory.java:230) at org.dom4j.tree.AbstractNode.createXPath(AbstractNode.java:207) a