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 ...