为嵌套类的方法获取JNI签名 [英] Get JNI Signature for methods of nested classes

查看:441
本文介绍了为嵌套类的方法获取JNI签名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个叫Scope的类,它有一个叫做Variable的嵌套类,我该如何使用 javap -s 获取类的JNI签名?我已经尝试过



javap -classpath< classpath> -s Scope $ Variable



,但这似乎不起作用。它似乎只是给我相同的信息,如果我只打字范围而不是范围$变量。



感谢任何帮助

解决方案

如果你在Linux / Unix环境下运行 javap c> $ 将由shell解释,而不是由 javap 解释。因此它被逃脱。最简单的解决方案是:

  javap -classpath< classpath> -s'Scope $ Variable'

没有引号的shell(我假设一个* sh后代)尝试用环境变量 Variable 的内容替换 $ Variable 部分。我假设没有这样的变量存在,因此没有任何东西(如空字符串)被替换。因此 javap 只能看到

  javap -classpath< classpath& -s范围

如果从Windows运行命令,那么这不是问题,因为神奇的角色将是



BTW:我不知道为什么JNI涉及这里。 >

Lets say I have a class called Scope that has a nested class called Variable, how exactly do I use javap -s to get the JNI signatures of the classes inside? I've tried doing

javap -classpath <classpath> -s Scope$Variable

, but this does not seem to work. It seems to just get me the same information as if I only typed "Scope" rather than "Scope$Variable".

Thanks for any help

解决方案

If you are running javap in a Linux/Unix environment, then the $ will be interpreted by the shell and not by javap. Therefore it mus be escaped. Simplest solution would be:

javap -classpath <classpath> -s 'Scope$Variable'

Without the quotes the shell (I assume a *sh offspring) will try to substitute the $Variable part with the contents of the environment variable Variable. I assume that no such variable exists and there fore nothing (as in "empty string") is substituted. Hence javap sees only

javap -classpath <classpath> -s Scope

If you are running the command from Windows, then this is not an issue, because the magical character would be %.

BTW: I don't know why JNI is involved here.

这篇关于为嵌套类的方法获取JNI签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆