284 questions
0
votes
0
answers
23
views
Reading configuration from Mojo annotation of class
I've written a build tool. This build tool can generate jars that conform to the requirements of Maven plugins. A Maven plugin jar contains a file called plugin.xml which contains various pieces of ...
0
votes
0
answers
58
views
Code Runner creates .class files along with the .java files in my src folder rather than bin (VS Code)
It works fine when I run it through the Java Extension Pack, though I would much prefer to use Code Runner for all my projects in all languages if that is at all possible. If anyone can help me I will ...
1
vote
2
answers
141
views
static java reflection - enum of fields of a class (pre-compilation)
is there a type of reflection in Java that provides simply an enum of the fields in a class?
The information is, afterall, "precompilation-static". Why should it not be compiled into the ...
0
votes
2
answers
82
views
". java" files which are saved in "d" and "e" drives, Didn't get compiled (Files were run from the VScode)
My hard drive has 3 partitions as c, d and e.
c drive is the main one.
I'm running these following codes through the VScode.Not the CMD or PowerShell also I didn't used the terminal section of the ...
0
votes
1
answer
348
views
Compile Java class files with external multiple jars using Javac
.java files are present in this folder exposeservices .
I am trying to convert these .java files to .class files using the below command.
These .java files have import statements so I have downloaded ...
3
votes
2
answers
16k
views
How to decompile Java Class file in VS Code
enter image description here
So I'm a new java developer and VS code is currently the platform I use. To my understanding every time you create a new object in Java, a class file should be generated ...
0
votes
1
answer
409
views
what is the file encoding type for java class file?
What is the file encoding type used for Java class files?
I am not referring to the file.encoding or Charset.defaultCharset() properties.
When javac compiles a .java file to a .class file and saves ...
0
votes
1
answer
96
views
Why only one .class file is created in java & which is declared first?
In Java:
class A{}
class a{}
after compilation : A.class
class a{}
class A{}
after compilation : a.class
Why only one class created?
the first we declared only that .class file generated
Please ...
-1
votes
1
answer
133
views
'package does not exist' using javac to convert .java class with google play services imports
I have a .java class which uses imports from google play services. I want to put this class in a .jar to package with my project, but using javac filename.java in the terminal gives me a bunch of ...
0
votes
2
answers
432
views
How to implements interface from .class file in .java file?
I have homework that asks me to use a .class file for my project, but I don't know how to use those files in a .java file. This is the project structure
agentes.class
datos_confidenciales.class
...
1
vote
1
answer
528
views
how to map parameter annotations to corresponding method parameter in classfile using asm
As per the jvms-4.7.18 :
The i'th entry in the parameter_annotations table may, but is not required to, correspond to the i'th parameter descriptor in the method descriptor (§4.3.3).
For example, a ...
1
vote
1
answer
144
views
how to show method parameter access_flags in java classfile
I tried to use javap -v on the classfile, but there is no information about method parameter's access_flags as defined in jvm-4.7.24 .
Is there another tool or approach to show them?
1
vote
0
answers
168
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 ...
1
vote
3
answers
62
views
why is the Java constant_pool memory allocation defined as having size constant_pool_count-1
The java class definition (docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html) looks like:
ClassFile {
u4 magic;
u2 minor_version;
u2 major_version;
...
0
votes
2
answers
423
views
Get java compiler version of a class file using xxd
I need to get the version of java that was used to compile a class file from a linux machine that doesn't have java. I have learned from a comment on this post that this is possible using xxd.
...
0
votes
0
answers
399
views
.class file too large
I have a kotlin file with a function that returns a list of strings with 10,000 elements, but when compiling it generates an error, saying that the .class file is too large. What I can do?
return ...
3
votes
1
answer
496
views
How do inner class access enclosing class' private members in higher versions of Java?
I have been trying to understand the mechanism of nested classes in java.
Consider the following code:
public class OuterClass {
private String privateOuterField = "Private Outer Field";
...
0
votes
0
answers
19
views
How to decompile java class files? [duplicate]
I am working on a static analysis tool for java applications. In one of the tasks I need to present the security analysis of a method and the corresponding method from the source code. In the case of ...
0
votes
1
answer
77
views
Java runs in eclipse and will compile, but wont execute on cmd, but still runs in eclipse. How can I get it to execute in cmd?
So I have a basic hello world set up in eclipse and I can compile it using cmd easily (I have set all the necessary paths), however when I then try to use the java command to execute the hello world, ...
0
votes
0
answers
3k
views
I Can't Change the Read-Only Status of .class Files in intellij
Image
I downloaded a .class file and opened it in Intellij, I pressed the lock button in bottom right corner and File>Make File Writable but I still can't edit the .class file. I own the file and ...
0
votes
0
answers
642
views
Authors in two columns for IEEEcsmag.cls
In IEEEcsmag.cls template for an IEEE magazine, authors can be added as follows (default).
\documentclass{IEEEcsmag}
\usepackage{hyperref}
\usepackage{upmath}
\begin{document}
\title{Title:...}
\...
1
vote
1
answer
2k
views
How to easily edit a .class file
I have a .jar file WHICH I DID NOT CREATE with many class files inside. I need to edit one specific class file. I have jd-gui. The unedited code of this class file, as shown by JD is:
package net;
...
0
votes
1
answer
133
views
Can I assume the capacity of a Java data structure is proportional to the memory taken by then data structure instance when the program is executed?
My intention is to analyze the bytecode of a Java program and collect the data about the data structures that have been used. That data includes the initial capacity and how the particular data ...
0
votes
2
answers
176
views
What format of file does linker produce after linking .class files produced by compiler in JAVA
While working with JAVA when compiler compiles are .java classes. It produces .class files and after compilation, the linker links all .class files to create one single file. My question is that what ...
1
vote
2
answers
298
views
How does the JVM know how many values to pop into a new frame when invoking a method via invokevirtual?
When a method is called via invokevirtual, the calling method pops off the values to pass to the called method along with the objectref and places them in the new stack frame.
How does it know which ...
2
votes
3
answers
604
views
Java .class file disappeares as soon as I run the project
I've been on a project where I build tetris that has multiplayer, and it's been working for a couple of days with no problem, but now suddenly there's this exception:
Exception in thread "main&...
1
vote
1
answer
1k
views
"VerifyError: StackMapTable error: bad offset" at the first instruction of a method in instrumented class
I used ASM to instrument a class file, and the instrumented class throws VerifyError. The error message is like:
java.lang.VerifyError: StackMapTable error: bad offset
Exception Details:
Location:
...
-1
votes
1
answer
3k
views
How do I fix UnsupportedClassVersionError when running in Eclipse? [duplicate]
I am trying to run a Java Application in Eclipse. I ran it about a month ago and it worked, and I can't think of what has changed. When I try to run it now, I get this error:
java.lang....
3
votes
1
answer
681
views
How to add/replace the SourceFile attribute in a .class file
I want to add/replace the SourceFile attribute in a compiled Java .class file. I have not noticed any obscure command-line options to the Java compiler to override the default value of SourceFile. ...
1
vote
1
answer
99
views
How to avoid storing duplicates in a Set if the objects type comes from a compiled .class file?
I am trying to store objects in a Set to avoid duplicates.
As this topic explains I need to @Override two methods: hashCode() and equals(Object obj).
The objects type that I am trying to store in the ...
-1
votes
1
answer
1k
views
Vscode create java project only two folders lib and bin
When I create a java project, there are only two folders lib and src, and not files such as .classpath or .project, I know that is integrated into the terminal of vscode
enter image description here
...
1
vote
1
answer
2k
views
Usage of 0xcafebabe in Java class file to identify byte order?
Is 0xcafebabe of the Java class file being used to identify the byte order e.g. in a network class loader? A java class could be serialized and sent over the network to another machine to be remote ...
0
votes
1
answer
742
views
.class file not being created in Sublime Text: Java
I am starting to learn Java and decided to use sublime text. I prepared a build system that would allow me to both compile and run the program. When I created my first file, it gave an error:
Error: ...
0
votes
0
answers
55
views
Why are my bin directories not getting filled with .class files?
Im practicing java, and I noticed that in my older projects, my bin directories have "mirror images" of "something.java" files. But now they just dont seem to appear, no matter ...
0
votes
2
answers
186
views
Is there a meaningful difference between running .class or .java?
I'm starting Java, and was reading the "Hello World!" for Microsoft Windows guide from Oracle. In the guide, it tells you to use javac to compile into a .class, then run with
java -cp . ...
0
votes
3
answers
944
views
Does a .jar file need all of the classes installed on a machine to run?
Does a .jar file need all of the classes installed on a machine to run? For example: if I ever distribute a program as a .jar file, will I also need to install all my .class files on the user's ...
9
votes
2
answers
13k
views
VSCode java how do I set the path for the compiled .class files to go?
I'm using the Java Test Runner extension in VScode, and I want it to compile my classes to a specific folder. I found the setting to change the -cp when actually running the compiled .class files, but ...
0
votes
1
answer
157
views
Why dont I have run icon next to class in intellij? [closed]
I can run java classes on intellij only by right clicking. I dont have run icon on left side of the class and @Test. My java class files are also not .class but .java files all the time, even when I ...
3
votes
0
answers
797
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 ...
1
vote
3
answers
3k
views
How can I get class files from Maven dependency into the target\classes folder
Is there any sort of Maven plugin that allows me to copy the class files for a dependency into the target\classes folder for my project? Currently I have to manually open the jar file that has the ...
0
votes
1
answer
166
views
Java - Compile using .class file
I have the following java class:
public class ExampleClass{
public static void main(String[] args){
Operation op1 = new Operation();
}
}
And then in another location I have this ...
0
votes
1
answer
13k
views
java.lang.UnsupportedClassVersionError: how to run code with a newer version of Java Runtime [duplicate]
While compiling from the command line, an error occurs, how do I get the required version of Java Runtime?
java.lang.UnsupportedClassVersionError: hello has been compiled by a
more recent version ...
0
votes
2
answers
471
views
With Android how to get the last modified timestamp of a file in Java?
In my Android app I need to display last modified time stamp of the program, so if I have 3 class files in an app, I want to get the last modified timestamp of each, and use the latest one as the time ...
-1
votes
2
answers
115
views
Why is the attribute_name_index in JVM Classfile an index?
This page https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.7 says
For all attributes, the attribute_name_index must be a valid unsigned 16-bit index into the constant pool of ...
0
votes
0
answers
130
views
Canonical way to map SourceFile class attribute to actual file system path
The SourceFile attribute only contains the file name, not a full or relative path. This is not much information to go with because javac will place the .class file in a potentially unrelated directory ...
0
votes
1
answer
510
views
How compile a java file to .class who use others .class. (if it's possible)
I get lib webrtc in a .aar, and I need to modify one file of this lib.
We can call this file tomtom.class for this example
So I unzip this .aar to get many .jar and in those .jar there the file ...
0
votes
3
answers
75
views
how to create check NetworkConnectionStatus in class file and use in mainactivity
add that in .class file and use in MainActivity.java
how to create check NetworkConnectionStatus in class file and use in mainactivity
Private void checkNetworkConnectionStatus() {
boolean ...
1
vote
1
answer
583
views
How much information of the source code does the compiled class file keep in Java?
When a class file from another project of my own was decompiled by IntelliJ
(by Fernflower de-compiler),
I was marveled at the closeness of the decompiled code compared to
the source code,
even the ...
1
vote
0
answers
3k
views
module-info.class file is different in the module jar file and compiled module-info.class
I have a simple module I'm building with maven and have a question about the resulting module jar. Here is the plugin section of my pom.xml:
<properties>
<java.version>11</java....
1
vote
2
answers
241
views
How can I extend JVM bytecode?
I want to create a programming language that compiles to its own bytecode format and a VM that interprets it. But I want the bytecode to be compatible with JVM. I've searched for any way to insert ...