Protocol to be used with in jar file [closed] - java

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)

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

How do i edit file with .class extension? [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'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.

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:

Add packages to a Tomcat server [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 8 years ago.
Improve this question
I'm creating a servlet-based application using Tomcat.
Besides that i've some classes to acces a DB with jdbc. (present in a other folder/package)
I was asking myself how to integrate them cleanly in my servlet-based application.
What's the "cleanest" solution ?
thx
I would go with packaging as a separate JAR file and placing in WEB-INF/lib of your web app.
While it may seem easier to just put JAR to the common libraries folder so that several web apps start using it - it will result in not being able to upgrade the JAR without restarting the whole server. Also you will need to make sure that the new JAR is working fine with all of the apps. Classpath issues are possible with this approach too.
Package them in jar files and then add files to you're project.

Categories