Newest '.class-file' Questions - Stack Overflow

Questions tagged [.class-file]

Class files are the format used by the Java Virtual Machine.

2
votes
1answer
55 views

Java ClassFile additional byte?

I read about Java ClassFile and I have tried to understand every byte in it. Basically everything is clear besides one thing... Just after the method definition (Code attribute) there is SourceFile ...
1
vote
3answers
34 views

How can I clean up my eclipse project after deleting a .java whose .class file still seems to be somewhere?

So, I deleted a couple of .java files from within eclipse because I didn't need them anymore. However for some reason another class still uses them and compiles without a problem. When I go to the ...
1
vote
0answers
22 views

Create executable jar including class files, manifest and external jars

I have two class files: Generator.class(Main) and Approach.class(Helper), which are created when I compile Generator.java code. The code is dependent on two external jars - argparse4j-0.7.0.jar and ...
0
votes
1answer
367 views

How to get value from gradle.properties in .class file at the time of build

I would like to get a property value from Gradle.properties in Java class. In Java, the value should be replaced at build time, and in the .jar(.class) file the value will come but not in a .java file....
-15
votes
4answers
148 views

Does every Java .class file contain a public class?

I got a question on an exam. Does every .class (not .java) file contain a public class? Yes? No?
0
votes
1answer
47 views

Cannot programatically compile Java source from string on Linux

I'm compiling Java classes from a string and for some reason however I'm doing it works fine on Windows but throws a NullPointerException on Linux. I've tried Googling to find a solution but I can't ...
0
votes
1answer
828 views

Docker Error: Could not find or load Main class Main.Main

I have coded this Dockerfile that makes a runnable jar out of a project and it also builds but when i try to run it, it says "Error: Could not find or load Main class Main.Main" Dockerfile: RUN yum ...
0
votes
1answer
45 views

How to comment lines of a .class file?

I want to comment out a few lines of a .class file. I do not have the source file, but when I decompiled that file, I found that it is trying to import non-existing classes and this leads to errors ...
-2
votes
1answer
44 views

Stack trace contains no line numbers: main(Unknown Source) [closed]

Trying to execute my project, I meet an error that starts with main(Unknown Source) and then propagates through the code. I think that in the brackets there should be written the line of code where ...
0
votes
1answer
179 views

Java 11 class file specification [closed]

I am trying to find the class file specification for Java 11 in order to find the differences between 11 and 8 LTS versions. I have found it for Java versions 8, 9 and 10, but not for 11: https://...
1
vote
1answer
89 views

Send Java Class as function argument

I want to pass a Java class as argument to a Java method. The method is getKeySpec() of class java.security.KeyFactory: getKeySpec(Key key, Class<T> keySpec) The NativeScript Typings for this ...
0
votes
2answers
45 views

Whenever i edit in java file , i have to restart apache server for apply those changes in class file

Whenever I make any changes in java file, I have to restart server again and again for even small changes it. changes do not publish to server. It is really time taken process. how can I apply those ...
0
votes
1answer
36 views

Why are CONSTANT_Long_info and CONSTANT_Double_info still 2 entires?

When the JVM was originally drawn up, the designers had the CONSTANT_Long_info and CONSTANT_Double_info structures in the constant pool take up 2 entries (supposedly because that way you could index ...
1
vote
1answer
178 views

Null is casted in decompiled java class file

I decompiled one of my java .class files and saw this line of code new ResponseModel("Reset Complete", false, (LinkedHashMap)null) The line corresponds to new ResponseModel("Reset Complete", false,...
1
vote
0answers
197 views

how to recover and decrypt encrypted files by grandcrab ransomeware virus

i noticed an unusual behavior in my file directory and to my surprise this files failed to open. on checking at the name i found out that a .krab extension had been added to this files together with a ...
0
votes
1answer
105 views

How to correct a mess java .class file set or generate a proper .jar archive from a mess .class set?

Background I have to contact different kind of Java project with various of build system. Sometimes the directory structure is different from the package hierarchy. So it is difficult to package. ...
0
votes
0answers
16 views

Import jar files while rebuilding an entire project in Eclipse with .jar files only

I need to rebuild an entire project into Eclipse. I just have .jar files wich contain only .class files. There are plenty of .jar files located in a lot of directories, how can I do that easily ? ...
0
votes
2answers
83 views

Determine path of class file that failed to load

We get an UnsupportedClassVersionError but have problems identifying the location of the offending file (>15 JARs in the classpath, several of which may contain the particular class). We suspect that ...
0
votes
1answer
72 views

issue with importing user-defined package in java

I want to import the .class files in a package into another file. The directory structure is as shown below. |-lib-(contains some jar files) | |-XYZ-| | |-CT-(package that contains some .class ...
1
vote
3answers
657 views

Create .class file from a jar file -java

I am using Java8. I have one .jar file containing .class files. I downloaded the source code of the same .jar file. And I edited one of the file in it. It is .java file. Now I want to compile all ...
1
vote
1answer
67 views

Will members be compiled into subclass's .class file?

In java, will inherited members(static or instance, method or field) be compiled into subclass's .class file? Or just keep a link to the super class's relavent member?
0
votes
1answer
27 views

How can I distinguish attribute_info in JVM ClassFile?

I'm digging into The ClassFile Structure. According to the document mentioned above, attribute_info can be appeared in various position. My question is how can I distinguish the type of ...
0
votes
1answer
62 views

Is it possible to write a java class file and then run it

Something like this: import java.io.File; import java.io.FileWriter; import java.io.IOException; public class WriteClassFile { public static void main(String args[]) throws IOException { ...
-1
votes
1answer
246 views

How to import .class files in eclipse?

I have a project which I want to import in eclipse and it has all files in .class format, If I create any file in eclipse its in .java format. The application is created in the spring framework. I ...
0
votes
0answers
60 views

Access .java src files in Reference Library that don't have .class files

I'm using Eclipse 3.8.0 on OSX 10.7.5 and I'm trying to run jzy3d-9.0 (a 3d graphing package). There are at least two libraries that I need import. The first library came in both .class and .java ...
3
votes
2answers
54 views

Why interface Member from Java 1.0.2 does not have ACC_ABSTRACT set?

I've written a simple Java bytecode parser to do some experimentation and recently it failed in an unexpected place. While reading java/lang/reflect/Member.java from Java 1.1.8.16's rt.jar, my parser ...
0
votes
0answers
172 views

Eclipse rcp 4 app export missing class files in the jar

I have a RCP 4 app with many plugin projects. The app runs well in IDE but when I run it after exported, some exceptions was throw (ClassNotFoundException). I investigated then see that it's ...
0
votes
2answers
95 views

Error reassembling Java bytecode into .class file using Krakatau

I'm trying to use Krakatau to assemble a native Java bytecode, acquired with javap -c, but I'm getting a weird error: > python Krakatau/assemble.py Main.bc Krakatau Copyright (C) 2012-17 Robert ...
4
votes
1answer
2k views

Where do you store Java .class files, conventionally?

I have a Java src folder in which I store my .java files. I then compile them using Terminal and end up getting .class files in the same directory. This doesn't necessarily bother me, but I've never ...
0
votes
0answers
497 views

'java' command on windows command prompt cannot run .class file

I faced a rather strange problem while executing a java program from the command line on Windows. I used this command to create a source.class file from a source.java file. javac source.java After ...
-2
votes
1answer
37 views

cmd prompt not compling my java files

I am using eclipse for my project , when i am running eclipse , my project work the way i wanted but when i tried to run on command prompt , i realize it is using the old .class file which is compiled ...
0
votes
1answer
464 views

Want Eclipse .class files also in other folder apart from bin

I want when Developer save java file in eclipse , And eclipse by default generate it .class file in bin folder,So this .class file is also generate in other folder also. I can not copy /paste that bin ...
0
votes
2answers
218 views

How to run a Java class file with a jdk binary?

I have downloaded jdk binaries (jdk.tar.gz) of different JDK versions, say 8u92, 8u121 and 8u131 in a directory. I want to run a Java program in each of these java versions and know the output. Is ...
0
votes
1answer
296 views

How do we clean out JSP's .class files when we re-deploy our application on JBoss?

I'm using JBOss 7.1.3.AS with Java 7. It is not an option to upgrade at this time. I notice that when our .jsp files get converted into .class files, they are placed here $JBOSS_HOME/standalone/tmp/...
2
votes
1answer
67 views

JVM spec: grammar for generic signatures requires lookahead

In the spec for generic signatures, ClassSignature has the form ClassSignature: [TypeParameters] SuperclassSignature {SuperinterfaceSignature} TypeParameters: < TypeParameter {TypeParameter} &...
1
vote
1answer
2k views

Missing class files after Maven build

I'm using Maven 3.3.9 on Windows 10. I have a multi-POM project, and I want to share some test resources across the Maven projects. As we all know the files in src/test/* won't be included in ...
0
votes
2answers
77 views

I have a class file which does not output the result due to code segment being the wrong length

Below is the hexdump of the class file in question. I have no idea about why this code doesn't run and it gives a java.lang.ClassFormatError: Code segment has wrong length in class file fibo when ...
0
votes
0answers
42 views

Compile Java code in-memory [duplicate]

I am looking to compile and run Java code - but without writing the .class files to disk. Is it possible to do this with Java? With Golang, we can use go run <file> and I think it will ...
1
vote
0answers
56 views

Can´t run .class in Terminal if .class was created in an package

I have the problem that i cant run my .class file in the CMD Terminal if i created it inside a package. Outside of the package i didnt have any problems and everything works fine but i wonder why it ...
22
votes
3answers
7k views

What is the maximum size of a Java .class file?

A .class file is a rather well documented format that defines sections and size, and therefore maximum sizes as well. For instance, a .class file contains a magic number (4 bytes), a version (4 bytes)...
2
votes
1answer
10k views

Compare files .class Bejond Compare 4

Good morning, I'm using Beyond Compare 4 (4.1.9) in order to compare war files. I need to compare the files .class that I find in the several packages. How I can compare them using this product?? ...
-2
votes
1answer
2k views

Editing a String in a .class file [duplicate]

Issue Hey. I've been developing a game and in the game, I was showing the version "1.0.13", and I quickly realized that it was completely incorrect, and it should display "1.9". I edit my code in ...
-2
votes
1answer
1k views

How to read java class file as a java string?

I have a requirement in which I need to read java class file as a string in java. my code is String path = "C:/java/MainClass.class"; String content = new String(Files.readAllBytes(Paths.get(path)));...
5
votes
3answers
225 views

Why do longs and doubles take up two entries in Java classes' constant pools?

The Java Virtual Machine Specification states that 8-byte (such as long and double) constants take up two entries in the constant_pool table, unlike other constants that take up only one entry each. ...
-3
votes
1answer
63 views

The class file for a new Thread and the class file for main are the same [closed]

I have a program called Main.java, shown as below. After compilation of this program, there will be two .class file: Main.class and Main$1.class. My problem is the two .class files are exactly the ...
1
vote
1answer
139 views

Add a class in Netbeans.

I have a homework assignment and the instructor has emailed me a .class file. I have unsuccessfully attempted: To add it to my folder where my .java files are. I have tried to add it to my /...
0
votes
1answer
72 views

Classes do not change

I have faced with a strange problem. Once I change the .java file - it seems that tests are using still the previous version of that file (.class). From my point of view the class should be removed ...
1
vote
1answer
52 views

Is the empty string a legal field/method name?

According to the class file format used by the JVM, may a field or method legally have the empty string as its "unqualified name"? The only real restriction I can find in the relevant section is: ...
1
vote
2answers
535 views

Java: Class files containing source code?

I was inspecting the class file format since I wanted to add source code to the class file (which was possible in early Java versions) but all I found was a SourceFile attribute and the SourceDebug ...
1
vote
0answers
166 views

ASM: assemble Textifier output into classfile

Does anybody know if any tool/library exists able to assemble output of ASM Textifier into a classfile? So, I have the following code: final ClassReader classReader = new ClassReader(bytes); final ...