Where to store java packages such as jsoup? - java

I am trying to download jsoup under the following link: https://jsoup.org/download but I am not sure where to save this in my library... Can someone help please!

Typically, things like that come in a JAR file, which is a fancy ZIP file for Java. All your JAR have to listed on the classpath. There are different conventions for where to put your JAR, but, for a simple app, they can be in the root directory of your classes.

Related

Adding Jsoup Jar to MapReduce

I am using the Jsoup.jar to get the keywords from the meta tag of several websites using MapReduce. The list of websites is being kept within a txt file. However when I compile the java file in terminal, it says that package org.jsoup.Jsoup does not exist. I made sure that the jar is in the same folder as that of the java file.
Screenshot of error:
You have to place the jar files in Distributed Cache it is a best practise to share the third party libraries,
Please have a look at below links for further help,
http://blog.cloudera.com/blog/2011/01/how-to-include-third-party-libraries-in-your-map-reduce-job/
https://hadoopi.wordpress.com/2014/06/05/hadoop-add-third-party-libraries-to-mapreduce-job/

view jar file through java code

I want to create one java application that will iterate an jar file and will give classes of that jar file.
I searched a lot but didn't get sufficient information.
I want java code that will open the jar file and will able to iterate that jar.
See:
java.util.jar.JarFile.entries()
http://docs.oracle.com/javase/6/docs/api/java/util/jar/JarFile.html#entries%28%29

Libraries to create jar from a Java file

I am trying to write a program in Java, which would collect a specified set of files from the physical location and place them in a jar in a certain directory.
I know I can use java.util.jar package for this. The package is great for sure, but I was wondering if there are any third party libraries that anyone at SO has used which they could recommend.
TL;DR: pick up files, create jar by placing them in pre-defined directories, all at run time in a java file.
P.S: I did not find any similar references to this question, but if there are then please refer me. Also, the title might be misleading, but I didn't find better words to explain my problem.
EDIT 1: I am not in anyway saying java.util.jar is bad or incomplete. All I am asking is if anyone has used any alternative solutions!
EDIT 2: I am trying to create the jar from inside the java program. The jar can be pretty big (~500mb) too. Trying to jar media files as well. So simply put, I pick up various files from certain locations on my drive and try to create a jar file by placing them in standard locations.
Thanks,
Ivar
Look at the java.util.zip package. Jars are just zip files with some extra stuff in 'em

how to use a .so and .jar in a java android projet?

I'm working on a java android project. this project requires to use specific commands.
these commands are all developed in c++/c but I've been given two files (.jar and .so) that are supposed to "turn them into" java, so I can use them in my java android project.
The thing is, what am I supposed to do with these 2 files?? I've read a lot of stuff (mostly about creating the .jar and .so, but I don't care about this step, for I already have the 2 files)
I tried to import the .jar (import external lib), I tried to add the .so via the static loading :
//static {
// System.loadLibrary("MySoFile");
// }
All I get is a stack overflow error or a problem with the DEX file...
Has anybody ever tried to do this??
I don't seem to get the point here...all I want to do is being able to use the commands in the .jar file.... ://
thanks in advance!!
Take a look at this answer about adding jar files. '.so' files can usually just be drag and dropped to the project.
All you need to do is make sure the jar is in your classpath and you can then access the classes within this jar. A jar is just an archive of classes, you don't need to load the library into memory or something similar.
You may want to read the answer to the question here How to use classes from .jar files?

Where is the documentation for the GeoTIFF-jai Library

I am trying to use the GeoTIFF-jai Library to generate a geo-rectified, raster image in Java. I have tried looking on the SourceForge site for the documentation on how to do this, but SourceForge says "Unfortunately, this project hasn't indicated the best way to get help." Has anyone else tried using this library and been able to find any documentation on it?
If there truly is no documentation, maybe you can answer this question. When I import the library .jar file into my Eclipse project (using right-click->Import...->Archive File) all of the .properties files import but not the .class files. I need the GeoTIFFFactory class from org.geotiff.images.jai in order to create a new GeoTIFF image but it's not available. Any idea why the .class files are not importing? Am I doing something wrong on the import? Is the .jar in the wrong directory?
Any help with either of these questions is greatly appreciated.
Thanks,
Ryan
When I import the library .jar file into my Eclipse project (using
right-click->Import...->Archive File) all of the .properties files
import but not the .class files. Am I doing something wrong on the import?
Yes. That's not how you use third-party jars in Eclipse. The wizard you invoked is used primarily for importing archives with source code to make changes to them. Instead create Java project to hold your source code and add a dependency on the jar via Project Properties -> Java Build Path. You can also attach a source code archive in the same place (get this from project's site on SourceForge). This will let you see any available javadoc and if there is no documentation at all, you can at least step through the code.
Regarding lack of documentation, you will be more likely to get help on that project's forum rather than on stack-overflow (since the odds of you finding help on stack-overflow with a particular library is inversely proportional to that library's popularity).

Categories