无法通过Davik VM执行.java文件 [英] Unable to execute .java file through Davik VM
问题描述
我正在关注链接
我首先成功执行了此命令。
I am following this link I have first executed this command successfully.
javac <path + filename>.java
然后,当我尝试执行以下命令时,遇到错误 类名与路径不匹配。
Then after when I am trying to execute following command I facing an error "class name does not match path".
dx --dex --output =<路径+文件名> .dex<路径+文件名> .class
.class和.java具有相同的名称,但是我想我必须编写.class文件名的显式路径。那么现在该怎么办。我正在执行一些小错误,但找不到。
I have same name for .class and .java but I think I have to write explicit path of .class file name. So what to do now. There is some minor mistake that I am doing but not able to find.
推荐答案
为避免幻数问题,首先检查您的jdk版本,看来jdk 1.7 *存在问题。我恢复到jdk 1.6。
To avoid magic number problem ,First check your jdk version ,it seems there is a problem with jdk 1.7* . i reverted to jdk 1.6 .
而不是使用 dx --dex --output =< path + filename> .dex< path + filename> .class
我们可以做一件事,将您的一个或所有.classes文件放在一个文件夹中,例如 classFolder
现在发出以下命令: / p>
Instead of using dx --dex --output=<path + filename>.dex <path + filename>.class
we can do one thing put one or all your .classes files in one folder say classFolder
now issue following command :
dx --dex --output=YourClass.dex absolutePath/classFolder
dx命令将选择该文件夹中的一个或所有类文件。
dx command will pick one or all class files in that folder .
这篇关于无法通过Davik VM执行.java文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!