I've created an API that I release as a JAR file. It's proprietary so I had to strip the source files out of it.
I currently include a separate /doc folder which contains the output of Eclipse's export-to-javadoc wizard. Not bad, but I'd like to go one step further.
I'd like to distribute the javadocs as a jar file that can be easily dropped into a future project which includes the jar file for my API. I know I've seen it done this way several times with other distributions I've used, but I haven't had any luck searching.
End goal is to allow future developers to have easy access to hover over comments and things of that nature.
Thanks!
It seems it is enough to package the doc folder containing the eclipse generated documentation as a jar file. Then if you want to use that jar as javadocs of the actual jar containing the compiled .class files, you assign the javadoc jar with the "Javadoc in archive" in Eclipse and set the Path within archive as doc. It seems Eclipse looks for index.html and package-list entries in the doc folder.
Also using maven-javadoc-plugin may an easy way to do this. See the link below:
http://www.avajava.com/tutorials/lessons/how-do-i-generate-and-deploy-a-javadoc-jar-file-for-my-project.html
If your end goal is just for the future developers to be able to view your javadoc instructions when they are using your classes or methods, in Eclipse you can have option to export java source files when you export your jar library as shown in the image below:
This also allows developers to step in and view your codes while debugging.
Related
I'm in the process of creating a JAR file using Netbeans. I am coming across a problem where I can not reference images or libraries without the /lib folder present with the JAR and my images in the JAR's current working directory. I need this JAR to be self contained and so when I build it I make sure that my library file and associated images are all within the JAR file itself. However my manifest file seems to be pointing to outside of the JAR as do any references associated with my JAR file. Is there a way within Netbeans to change these options when building?
It is possible to put several files inside the Jar file, but it didn't crossed my mind to do so with the libraries.
Try to see this link: https://www.google.pt/#q=JAVA+put+libraries+inside+JAR.
As far I can see in a small rechearch, is possible using external tools, or simply using ant.
Check this link as well (as shown in the previous link I gave you): Put external library to the JAR?
Google is a powerfull tool, use it more often.
I hope I could help.
I'm building a java project that implements Twitter Storm, and I want to extract and package in my custom libraries into the .jar file. However, if I extract all the required libraries (using the Extract required libraries into generated JAR, the .jar ends up being 20mB in size, as opposed to around 200kBs (using the Copy required libraries into a sub-folder next to the generated JAR option).
Is there any way I can specify which libraries I want to be packaged in? Ideally, I'd be able to select these to be extracted into the .jar file, while the rest are excluded. I can't seem to find an option in Eclipse to do this.
Thanks very much
I think your best bet is to use the option to "Save as Ant script" and then edit the build.xml to remove the jar files that you don't want to have included in.
Dealing with build.xml files in Eclipse is very easy/natural. If you do show view/Ant, and then drag the build.xml from the package explorer to the ant view, you can just double click on it. Much easier than going through the export dialog e very time.
I have to write a java application which I'm putting together using eclipse and it relies on open source code. This application needs to be self-contained, meaning that I'm supposed to create a jar file that has no external dependencies.
I can use the open source code when I reference the jar files in the project's build path, but the idea is to have the actual source code as part of the eclipse project, side-by-side with my code.
The source code can be found here: http://hc.apache.org/, but when I import an existing file system into my project I can't quite get things to work. The packages end up with the wrong names, breaking references, and I can't do anything. Notice that the folder containing the source code has this structure:
httpcomponents-client-4.2.3\
src\
httpmime\
httpclient-osgi
httpclient-contrib
httpclient-cache
httpclient-benchmark
httpclient
fluent-hc
each of those subfolders has src/main/java/org/apache subfolders.
Can someone please explain how to do this? Am I supposed to import everything one java file at a time?
Use a tool like OneJar, FatJar, JarJar, etc. to create a single-jar application.
As Charlie mentioned, the Maven Shade plugin is another choice, particularly if you're already using Maven. If you're not, consider it or another transitive dependency management tool.
Some tool should be used, IMO, and it's more important the more dependencies you have.
Alternatively you could use a jar class loader and include the jar file in your artifact.
I would most definitely not include the source of dependencies in your own project.
Is it possible to ignore files from being packaged into the Android APK? For instance, I have my .psd files in the same folder as their .png counterparts, and all the .psd files get packaged up.
I know I can move them outside of the folder, but I like having them in all together and would prefer not to if possible
This is actually supported in the Android Asset Packaging Tool (AAPT).
I always put my psd-like files in the resource directories like this:
/res/drawable/_pre_production/ic_launcher.psd
Any _pre_production directory will not be added to the APK.
With this approach they're in a sub-directory of the actual images' directory, but I don't see the problem with that. It is still neatly organized. ;)
An Ant script will do the trick. If you are using proguard, even that script may be good enough for u.
Use the Maven Android Plugin and declare your resources with a matching pattern that excluded the relevant file types you dont want added (e.g. */.psd). Check out the documentation for the resource plugin and look at the Maven Android Plugin Samples project .. specifically the MorseFlash application I created and the resource plugin related setup.
You can try using the maven android plugin and adding some logic to the build phase.
If you are using Eclipse, right-click the file and select "Exclude from build path"
I'm new to Java. I have to modify this Web Servlet that is running on my Tomcat. The Webapps folder contains several files and directories, but only one .JAR file. I managed to decompile it using Java Decompiler JD-GUI, but when I create the project in Eclipse from the decompiled source and try to Validate it, Eclipse shows me around 389 errors. Errors like
HttpServlet cannot be resolved to a type
And I don't even know which Eclipse button rebuilds the .JAR file. Can anyone help me?
Your eclipse project will need to include the libraries that the servlet relies on to work.
If you create the Eclipse project as a Dynamic Web Project it will set up some of the basic structure needed, including the relevant libraries. You may need to include other libraries if the original code relies on them, but from your description it seems fairly unlikely.
You can create a JAR file from the Eclipse File Menu. click Export..., and select Java->Jar file.
Many projects will use ANT which allows you to define scripts to perform tasks needed to compile, package, deploy and test a project.
you create the Eclipse project as a Dynamic Web Project it will set up some of the basic structure needed, including the relevant libraries. You may need to include other libraries if the original code relies on them,
create a JAR file from the Eclipse
File Menu
click Export..., and select Java->Jar
file.