javap

No javap tool not found in Scala REPL

时光毁灭记忆、已成空白 提交于 2019-12-11 18:08:06
问题 I am using Scala 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_79) on Windows 10. I did following in REPL scala> class Book (val title:String) defined class Book scala> :javap :javap [-lcsvp] [path1 path2 ...] scala> :javap -c Book Failed: No javap tool available: scala.tools.nsc.interpreter.JavapClass$JavapTool6 failed to initialize. My PATH environment variable has C:\Program Files\Java\jdk1.7.0_79\bin and JAVA_HOME is set to C:\Program Files\Java\jdk1.7.0_79 I can see the javap.exe

Why is my javap output different than yours for the same jar file?

≯℡__Kan透↙ 提交于 2019-12-11 16:42:16
问题 I'm having trouble compiling code which has a maven dependency on jline-0.9.94. Specifically, I'm compiling Groovy 1.7.6 using its default Ant target and getting the following error: [...] -banner: [echo] Java Runtime Environment version: 1.6.0_22 [echo] Java Runtime Environment vendor: Apple Inc. [echo] Ant version: Apache Ant version 1.7.1 compiled on June 27 2008 [echo] Operating system name: Mac OS X [echo] Operating system architecture: x86_64 [echo] Operating system version: 10.6.6

How to use javap to see what lines of bytecode correspond to lines in the Java code?

不打扰是莪最后的温柔 提交于 2019-12-11 05:39:48
问题 I was tasked to make a method that calculates the magnitude of a given vector and then used javap -c to break it down. Now I must show what each local variable in the magnitude frame corresponds to in the java, and which lines of bytecode correspond to what. Here is the method I made: public class Vector { /** Magnitude of vector * Calculates the magnitude of the vector corresponding * to the array a. * * @return magnitude */ public double magnitude(double[] a){ int n = a.length; double sum =

Can javap show the original source code lines intermingled with the bytecode like objdump -S?

妖精的绣舞 提交于 2019-12-07 04:10:24
问题 I know this debug information is contained in the .class file when compiling with: javac -g Main.java and can be observed manually from the LineNumberTable: section of: javap -c -constants -private -verbose '$<' > '$@' What I want is to make javap display the source in the middle of the bytecode. Sample input: public class New { public static void main(String[] args) { System.out.println(new Integer(1)); } } Actual javap output: 0: getstatic #2 // Field java/lang/System.out:Ljava/io

Displaying generic type parameters from compiled class files

橙三吉。 提交于 2019-12-06 06:03:57
Is there a tool similar to javap that could display methods and fields with their original (non-erased) types? I know that the type information is erased when source code is compiled. However, the compiler must know somehow, because it is able to determine if my calls to library methods match their signatures even if the library is already compiled into class files. So at least in theory, it should be possible to retrieve the type information. I searched further and I found this answer: Where are generic types stored in java class files? which pointed me to getGeneric...() methods. So it looks

Inner Class in Java

蓝咒 提交于 2019-12-05 20:29:36
问题 I was reading about Inner class in Learning Java. I found this code class Animal{ class Brain{ } } After compiling, javap 'Animal$Brain' gives output as Compiled from "Animal.java"class Animal$Brain { final Animal this$0; Animal$Brain(Animal); } which explains how the inner class gets the reference to its enclosing instance in the inner class constructor. But when I define the inner class as private like this class Animal{ private class Brain{ } } then after compiling, javap 'Animal$Brain'

Java : javap ERROR:Could not find .class

戏子无情 提交于 2019-12-04 17:17:25
问题 In my system(Ubuntu 10.04) java is running fine but I am not able to run javap command I have complile Foo class and .class file path is locate at /home/mahesh/java/opt when I execute javap -c Foo.class I get following error message : ERROR:Could not find Foo.class Is there any need to set any environment variable or any thing else to resolve it. my $PATH variable is target to: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/bin/ Thank you. 回答1: You just

Inner Class in Java

北城余情 提交于 2019-12-04 02:36:53
I was reading about Inner class in Learning Java. I found this code class Animal{ class Brain{ } } After compiling, javap 'Animal$Brain' gives output as Compiled from "Animal.java"class Animal$Brain { final Animal this$0; Animal$Brain(Animal); } which explains how the inner class gets the reference to its enclosing instance in the inner class constructor. But when I define the inner class as private like this class Animal{ private class Brain{ } } then after compiling, javap 'Animal$Brain' gives the output as Compiled from "Animal.java" class Animal$Brain { final Animal this$0; } So why is the

What does “p” in “javap” stand for?

不想你离开。 提交于 2019-12-03 04:14:03
问题 What does "p" in "javap" stand for? (The "c" in "javac" stands for compiler) 回答1: By default, javap prints declarations of the non-private members of each of the classes specified on the command line Reference : http://docstore.mik.ua/orelly/java/javanut/ch16_08.htm 回答2: it stands for java printer.... 回答3: It prints the methods declarations in your class and its a very good way to see the how your compiler has interpreted your code and convert your source file into .class format. 回答4: The

How to learn about using scala.None from Java using javap?

两盒软妹~` 提交于 2019-12-03 00:16:42
问题 In a previous question, Accessing scala.None from Java , it seems that people had used javap to figure out how to access scala.None from Java. I would like to know how they did that. FYI, the answer is: scala.Option$.MODULE$.apply(null); which can be shorted to: scala.Option.apply(null); Given this program ( OptionTest.scala ): object OptionTest extends App { val x = scala.None val y = scala.Some("asdf") } I ran javap on it like this: javap -s -c -l -private OptionTest This is a portion of