Java: edit and recompile .jar? - java

I downloaded JGraphT, and I want to make some changes to the core files. I'm using Eclipse. It wants a .jar or .zip to attach source files to the .class file. I have the .java file, but I'm not sure what I should do. Do I edit it, then recompile the jar?

I would start by going to the Sourceforge Developer tab for JGraphT, and follow the instructions on checking out the latest source code :
svn co https://jgrapht.svn.sourceforge.net/svnroot/jgrapht jgrapht
Then create a project in Eclipse from the sources, and read through the README on how to build and deploy.

Related

How to import&edit Jmeter jar file/jar plugin in eclipse

I'm trying to import jar file ( which is a plugin for jmeter-i would like to edit it and again i want to jar it in eclipse ) in eclipse to see the source code of it.But im not able to see the source code of the jar file.
Can anyone help me how can i decompile a jar and make it editable in eclipse.
i decompiled online and used it in eclipse but eclipse is throwing number of errors.
By using jd decompiler i can view the .class of it .but i would like to edit the jar file according to my requirements.
From comments you need Jmeter InfluxDB Plugin.
Download source code and uzip it.
Apply your fixes and use gradle to build the jar in Eclipse.

What is a sources JAR?

I was recently trying to import a library to use for something I am working on.
https://sites.google.com/site/piotrwendykier/software/jtransforms
I was having some difficulty because the JAR that I added to the build path was the "JTransforms-3.0-sources.jar" and not the "JTransforms-3.0.jar".
Now I am sort of scratching my head and just wondering what that first sources.jar was if it didn't have any of the classes that I wanted to use in it.
What is it and what is it for?
That sources jar is a jar that contains only the source code (the .java files) corresponding to the compiled artifact. It is useful to add it as a source attachment in your IDE, to publish the sources, etc.
As it only contains sources, not compiled classes (.class files), it is of no use as a library dependency.
What is it: Source JARs are the JAR file which contains only source code files i.e. .java files, and no compiled .class files. For example, you can download OpenJDKâ„¢ Source files from http://download.java.net/openjdk/jdk8/
What is it for: It is useful for other developers so that they can 'attach source' and debug into their project source code.

Eclipse export libraries with non jar files

I'm facing a problem I have never had before when exporting my eclipse project with external library. I made a little program with spelling correction and I used the language tool library you can find here.
I put this library in the build path and correctly imported into my eclipse project. When I ask to export it into a runnable jar, Eclipse exports only the jar files into languageTool library, but this library contains also some txt and xml files. So when I try to launch the application from command line it gives me error because can't find this txt and xml files. I tried to add to my jar archive manually but obviously it doesn't work. How can I fix it?
Thanks for your time and forgive me for my bad english.

How would you export Javadoc as a .jar file in Eclipse?

I'm finally done with my project, JConsole Maker. I put all the Javadoc comments in and I'm ready to export the Javadoc. I just don't know how. I can do it into a folder, but is there any specific way to export it to a .jar so Eclipse developers can use it too?
My answers does not correspond exactly what you're asking but here is a way to build a .jar of your project (JConsole Maker) with associated javadoc:
Once you have generated the javadoc into a folder, do
File > Export...> Java > Jar File and check "Export Java source files and resources".
Then your javadoc will be associated with your whole project.
Please notice that your sources files will also be included...

Viewing source code from a third-party jar in Eclipse

I am working on a Java project in Eclipse. In this I am using a third party JAR which I have put in on the classpath. Now I want to understand the code in the JAR file and want to see the actual code and navigate through the third party code just like my own code.
My question is this: Instead of me manually decompiling all of the class files in the JAR and putting them in the appropriate folder as per package declaration, is there some way in which Eclipse will decompile them for me, and put them in the appropriate folder? What should be the approach taken in such a scenario?
The decompiler I use is JAD. It has an eclipse plugin, Jadclipse.
You can download JAD from http://www.varaneckas.com/jad
You can get Jadclipse from http://sourceforge.net/projects/jadclipse/. Click on the download jar and then simply copy the jar into your Eclipse/plugins directory, and restart Eclipse. Set up the path to JAD from Preferences->Java->JADClipse. Then trying to view a class should give the decompiled code.
I have been using Java Decompiler for some time and have found it very useful, i don't know about eclipse but it seems to have a eclipse plugin: JD-Eclipse

Categories

Resources