How do i edit file with .class extension? [closed] - java

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
i've to modify a plugin for my minecraft server (yes, i'm allowed to do it).
The problem is that the files that i've to modify have .class extension and despite a found a way to see those files with jd-Gui, i did not found a way to edit them. Can you please explain me step by step how to do it?
p.s. I use MacOsX system.
Thanks to all of you.

It is not a good idea to edit .class files because of dependencies and relationship with other classes. Also because .class contains byte information and not recommended (not possible in many cases) to edit it manually. The file is generated when you compile your java file. So, find the java source file, compile it, and it will update the .class file.
Good luck.

Related

How to generate files in source folder using Bazel? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm trying to use VS Code to write Java programs which are built Bazel. Most of vs code extensions don't know about Bazel. Therefore code complete works only for the .java files understand the same folder.
I came up.with this idea of generating Eclipse's .project and .classpath out of Bazel java_* targets. I manually created these files and code completion worked perfectly.
So now the question boils down to: how can I automatically generate .project and .classpath files in the same diretore of BUILD file?
Sounds like they already decided not support it: https://github.com/bazelbuild/bazel/issues/3376

When to create .exe file using Java? Why it is needed? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I am looking for answers for the questions Can a java developer create an executable jar as in ".exe" file? Why it to be created and where it is used? Please brothers help me with these questions. Interviewer has asked me this questions because of these questions I got rejected. So please help me to know better about this.
Yeah you can transform a jar -> exe and it is mostly used to make a jar run easily on windows. If you double click a jar file it doesn't mean it has to be executed as well, but using an exe ensures this. Also you secure your jar a bit from decompiling.
But I really don't believe that such a question rejects you from a job offer ^^

How to convert .class file to .java file? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am trying to convert a .class file to .java. I have only the .class file. I used jad, but I'm getting error as:
The class file version is 49.0( only 45.3, 46 and 47 are supported) JavaClassFileParseException.
How do I resolve this issue? Kindly provide your valuable inputs.
The Simple way to do is using: SeeMyCode
use Java Decompiler http://jd.benow.ca/ in it you can open jar, or .class and it will converted to java source.
It's because you care using a lower version of Java than the one that was used for compiling the class

Compile and emit bytecode from generated code [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Is it possible to compile and emit .class files at run time? I have some generated servlet code and I want to compile them into classes and package it as a war.
Thanks.
Just export the generated codes into files in a temp directory, invoke javac in there, package them, serve them. Nothing fancy needed.
Yes, it is.
You can take a look at the Java Compiler API doc
Note however, that you will have to provide the corresponding ClassLoader and manage all the resources yourself.
If you want to generate bytecode from non-Java sources, you can also use ASM directly:

Protocol to be used with in jar file [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have to make a call from my java code to some other classes that is within jar file .So which protocol it is going to use .
Regards,
Raj
What do you mean by protocol? a jar is an ordinary zip file. You just need to include the jar in your classpath and you are good to go.
It does not need any protocol. The class file inside the Jar would be accessed directly just like any other class on your classpath.
If you have a run-able jar which contains runnable program with main class just use
java -jar < your jar file here >(if you want to run it)
otherwise import it to your project.(not sure what you mean by mentioning about a protocol)

Categories