Questions tagged [javap]
javap - The Java Class File Disassembler
javap
125
questions
0
votes
2
answers
72
views
Is there a way within a bash script to determine the minimum java version required by a jar file containing class files and jar files?
For a single class - we can work out the version of Java used to compile it:
javap -verbose className
I have a scenario where I need to scale this up to a jar file containing many classes and jar ...
0
votes
0
answers
422
views
javap command not working with %JAVA_HOME% being set
Im deep diving into the JVM architecture and I wanted to inspect the constant pool for one of my java classes which belongs to a Spring Boot project.
I have my compiled java class and I am trying to ...
0
votes
1
answer
83
views
javac reports "package does not exist" even though classpath is set
I have a file Test.java (stripped down for debugging):
import com.github.tkutche1.jgrade.Grade;
I try compiling it with this command line and get an error:
# javac -cp lib/com/github/tkutche1/jgrade/...
0
votes
1
answer
46
views
Why does an anonymous inner class have such type when I disassemble the class file using javac?
When I disassembled the code given below, I noticed that the TestClass's anonymous inner class in constant pool is displayed as 'AnonymousTestApp$1', but shouldn't it be 'TestClass$1'?
The code:
...
1
vote
0
answers
151
views
How to syntax highlight a hex dump of JVM classfile?
I'm studying binary file structure of JVM classfile.
My current toolbox consists of $ xxd <classfile> and $ javap -v <classfile>.
Sample outputs of these two tools are as follows:
$ xxd ...
0
votes
1
answer
129
views
How to read a file from nested jar at Linux?
Is there any way to read some files from a jar inside the "outer" jar with javap command?
for example, I want to read the a.class
A.jar
|----/lib/
|---B.jar
| ...
1
vote
0
answers
2k
views
Downgrading java version in project (IntelliJ)
I am trying to downgrade the target build version of java, but somehow I can´t change it within IntelliJ, don´t understeand why.
Under File -> Project Structure -> Projects I changed the ...
0
votes
2
answers
108
views
Can java disassembled code run without OS?
I disassembled a java class file to Assembly using javap. Then Can I run the assembly code generated by the javap command without Os? Or is there something like il2cpu.net for java?
1
vote
2
answers
294
views
java internal method signature doesn't match constructor parameters (javap)
I have the following class containing local inner class:
class Outer {
private boolean beep;
private int foo;
public Outer(boolean beep) {
this.beep = beep;
}
public void ...
0
votes
0
answers
762
views
Javap Command Error in Java On Command Prompt
Why javap command is not running in command prompt and its showing javap is not recognised as internal or external command except javap all other command is running well.
0
votes
0
answers
55
views
How to write scala jar executable by Java to fetch hostname of the machine?
I want to perform this activity in Scala and execute it with Java:
hostname -i
The scala code for this is:
import java.net._
object HostName {
def main(args: Array[String]){
val ...
2
votes
1
answer
129
views
Why, after compiling an interface, "default" method modifier is gone from "javap -v"?
I have observed, that after compiling an interface containing default method definition, like:
interface Delta {
default void someMethod() {
System.out.println("Hi.");
}
}
...
4
votes
1
answer
214
views
Problem marking the lines in the java compiler
I am a master's student and I am researching static analysis.
In one of my tests I came across a problem in marking lines in the java compiler.
I have the following java code:
226: String json = &...
1
vote
1
answer
855
views
How to load a class from module(.jmod) file at runtime?
I want to load classes from a module (.jmod) file at runtime into the application memory.
I know that we can easily load classes from a (.jar) file using :-)
ClassLoader loader = URLClassLoader....
0
votes
1
answer
107
views
grep method appears in class file but not in its human dump
I'm grepping for a method getNumBytes in some class file A.class:
$ grep -rn "getNumBytes"
Binary file A.class matches
When I dump its content with javap I can't see my method:
$ javap -c -...
0
votes
1
answer
326
views
How can I disassemble all code with javap? [duplicate]
I want to look at the bytecode of a Class file with javap -c, but it doesn't seem to disassassmble all my code. Here is FooBar.java:
class FooBar {
public static void main(String[] args) {
...
0
votes
0
answers
203
views
javap -c does not give me bytecode of methods
I have a java file looking like this:
package answers;
class finalRed{
private long l;
public synchronized void increment(){
l++;
}
public void decrement(){
...
0
votes
0
answers
496
views
java.lang.verify error : Inconsistent stack height 1 != 2
I have a custom application in which we have generated the Java Instruction code.We are generating the code using javacc. In one of the Scenarios, we are getting java.lang.verify error : Inconsistent ...
1
vote
0
answers
69
views
Implementing an interface in Java - Why does javap output two methods with the same signature but different return type?
Given this Java code:
interface I {
Object getId();
}
class A implements I {
public Long getId() {
return null;
}
}
javac I.java A.java
It compiles successfully. When disassembled the ...
1
vote
1
answer
139
views
duplicate method in javap result
There is a method in BaseController, e.g.
public abstract class BaseManagementController<V, F extends BaseForm> {
@PostMapping
@ResponseStatus(HttpStatus.CREATED)
protected void add(...
0
votes
0
answers
76
views
Java: Safety of rewriting bytecode to add interface
To try to forestall any concern, this is for a personal project. I'm more interested in learning about the internals of the jvm than I am in hearing about what a horrible idea this is :)
Normally, ...
3
votes
0
answers
745
views
Open .class file with Java Decompiler - incoherent errors
I am an Ubuntu user, I have a lot of .class files in which ground truth information about a dataset I'm using is stored.
I want to access this information (not modify it) and export it to .csv files ...
0
votes
2
answers
200
views
How to get the output of javap to multiple text files
I know this is a simple question but I am quite new to programming and I want to know if there is a way to get the output of a javap file to multiple different named text files. Eg. In the case of one ...
1
vote
2
answers
681
views
How to check imports of a *.war file?
I have an old war-file where the source code was lost as my old machine passed away.
It did run there with tomcat 8 with no problems.
On my new machine, when tomcat (8 as well as 9) tries to deploy ...
4
votes
2
answers
399
views
java JVM bytecode notation, comment grammar. InvokeDynamic
Question: What does line 14 means?
Use javap -v -c to disassembly the following code:
public class test {
static int i = 2;
public static void main(String[] args) {
test x = new ...
0
votes
1
answer
164
views
Does the instruction istore start at index 1 in the main method?
Given the instruction istore_<n> and its documentation:
n must be an index into the local variable array of the current frame (§2.6).
It does not specify what index it starts at. I assume 0. ...
0
votes
1
answer
699
views
Where can I find the source code for javap application? [closed]
javap is the Java Class File Disassembler.
Which, in my system, is an application that belongs to Oracle JDK.
$ javap -version
1.8.0_201
$ which javap
/opt/jdk1.8.0_201/bin/javap
$ head -2 /opt/...
0
votes
2
answers
49
views
Angular braces notation for types resulted by javap
In java profiler command output, I've been seeing these notations in angular braces like
java.util.Queue<E>
java.util.TreeMap<K, V>
Correct me if I'm wrong; working through some ...
1
vote
1
answer
187
views
Intellij on Linux: Menu: jdk > javap option
I use Intellij community 2018 on Ubuntu. How can I have a jdk option in the menu that appears after right clicking inside the editor window?
I don't know if this option is built into the IDE or some ...
2
votes
1
answer
341
views
Stack=4 in Java bytecode. How does the Java Compiler compute the 4 value? (depth of the the stack)
Java Code:
public class SimpleRecursion {
public int factorial(int n) {
if (n == 0) {
return 1;
}
return n * factorial(n - 1);
}
}
Gives the following ...
1
vote
0
answers
56
views
What does stack=1 (or any integer value) mean in Java bytecode [duplicate]
I've been trying to understand how the bytecode of the following Java code works. I couldn't find the explanation of what the stack=1 and the stack=4 part mean.
Java Code:
public class ...
4
votes
4
answers
20k
views
JDK installed but no javap?
I have the JDK 10.0.2 installed, have the cmd opened in the folder of the class files of my program and try the command: javap Simulation.class .
I get the error that the command javap is not found. ...
2
votes
1
answer
83
views
Why bytecode sequence number are not continuous
static void heapVar();
Code:
0: iconst_3
1: newarray int
3: dup
4: iconst_0
5: bipush 100
7: iastore
8: dup
9: iconst_1
10: sipush 200
13: iastore
14: ...
-2
votes
1
answer
633
views
I am trying javap -p classname on scala class but getting error in REPL
scala> class Department( val departmentId: Int, val departmentName: String)
defined class Department
scala> javap -p Department
<console>:12: error: not found: value javap
javap -p ...
-1
votes
1
answer
47
views
Java byte code classes interpretation
I understand the basic Java bytecode instructions and how fields are referred from the constant pool.
But I cannot make my mind around the differences between these 2 lines:
java/lang/StringBuilder....
0
votes
0
answers
693
views
use javap from within a java program on all the files
I have to implement javap -verbose from within a java program, the directory named folder has multiple classes and i want to use this javap -verbose on all of them so i do,
Process p = Runtime....
3
votes
0
answers
470
views
View javap -c output within IntelliJ
I'd like to view Java bytecode the way the command javap -c outputs it, not like the "View Bytecode Plugin". Is there a way to accomplish this?
Example: This method
public void increment() {
c++;...
0
votes
0
answers
841
views
javap not showing the annotation information in the decompiled class
I have a jar with a simple java class like below
package org.debraj.pkgcmp.dummy;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import com.google.common....
0
votes
1
answer
215
views
Is it possible to estimate performance or cyclomatic complexity from decompiled code?
Let's say I have two alternative implementations of an algorithm, or two strategies. I could of course benchmark them with e.g. jmh. But is there any information I could get by looking at the ...
1
vote
1
answer
395
views
Javap -l does not show me my local variable table
For some reason, Command prompt isn't providing me with a local variable table, even though I am using the -l option. Any suggestion/points?
Edit, here is the code for SumSqrt class:
public class ...
1
vote
0
answers
1k
views
how to map bytecode line number to sourcecode line number
I'm creating a program to find null pointer dereference in java. The methodology used is to first extract java byte code using javap command and then extract control flow graph(CFG) information from ...
0
votes
1
answer
580
views
Bad local StackMapTable
I've generated a simple getter method with ASM in an already existent class.
mv = cn.visitMethod(access, // public method
"get_" + f.name, // name
...
4
votes
2
answers
293
views
In java we can explore a java class, methods by using javap disassembeler. how to do the same in c++?
I'm new to this community so, if I'm violating any t&c of our community by asking this question in wrong section, then I'm sorry.
I've been searching answers for the above question for quite a ...
-1
votes
1
answer
207
views
Object.clone() in javap when using covariant return types in Java
I am reading about covariant return types in Java. I wrote the following code:
A parent class:
package other;
public class Super implements Cloneable {
@Override
public Super clone() ...
0
votes
1
answer
82
views
Understanding Type in Compiled Scala File
Given:
$cat build.sbt
scalaVersion := "2.12.1"
$cat src/main/scala/net/X.scala
package net
trait Foo
object X {
val a: Int with Foo = 42.asInstanceOf[Int with Foo]
println(a + a)
}
...
9
votes
2
answers
1k
views
Inner Class in Java
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
...
0
votes
2
answers
169
views
the constant pool lost #3 in class file
I use "javap -verbose" to parse a class file and find the constant pool lost #3, anybody can tell me the reason?
0
votes
1
answer
288
views
Getting the arguments for the bytecode using Javassist
The disassembled code (using javap -c) of http://lpaste.net/338173 looks like this: http://lpaste.net/338175 , on the third column, there is 200 as an argument to "sipush" how can I get this from a ...
0
votes
1
answer
558
views
No javap tool not found in Scala REPL
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 [...
0
votes
1
answer
451
views
Understanding javap output
I have a very simple class:
package MyDev;
public class Point3D {
public Point3D(){x = 0; y = 0;z = 0;}
public float x, y, z;
public Point3D( float X, float Y, float Z )
{
x = ...