java how to import JAK API/library with eclipse - java

this is the API i want to use: https://labs.micromata.de/projects/jak/quickstart.html
i tried to download and unzip the files (including JAXB) but i have no idea what to do with them. how do i add it to my project?
i searched for how to add API/library but all results told me to import the jar file. did not find any jar file. the unzip folder just looks like a regular project folder. i also tried to export that folder into a jar file, it did not solve the problem, tried to copy and paste the folder into my project, also did not help.
in the doc it says:
Download the Java API for KML JAR at GitHub and add the JAR to your
classpath.
If there are any dependencies, resolve them and add JAXB to
your classpath, too. Version 2.1.xx should be fine.
to add what JAR? i'm really confused

Related

how to add a jar file into intellij

I have a jar file which is a bunch of .class files(Java). I need to use some of the classes inside of the jar file into my intellij project. I followed these instructions:
Adding class/jar file to IntelliJ IDEA
The jar file did successfully link into the project as an external library. But, I am not able to access any of it's classes. Nor am I able to import any files from it. Can some one help me out ?

Adding xml resource files to classpath in Bazel

I'm currently using Bazel on my project, and it needs to load some .xml files which are located in src/resources (you know, the standard Maven file structure). The thing is, when I build the project, this files are not imported into the classpath.
I know that java_library and java_binary have the resources option, but that seems to be for java classes. I tried adding it anyways like this: resources = glob(["src/resources/**"]) but it did not work.
So, how can I add those .xml files to the classpath, so they are added into the compiled .jar?
Solved by using filegroup as per this question.

Empty .jar File in Ecilipse

i just imported a Jackson's annotation library and imported it into my java application project in eclipse. However, after importing, the package doesn't contain any java files.
If I open the .jar file using a .zip extractor, all the java files are present.
Anyone knows how to rectify this?
Thanks already.
Screenshot : Empty
You need to add the binary jars (jar which has the class files), and not the source jar files.
If you add the source jar files and imported to your buildpath eclipse wont show any java files.
Instead first add the jar containing the class files, and then you can attach the source jar to the binary.

How to execute a jar that uses another jar

I have a little problem importing a project to my android project.
I have built a little library using Ical4Java to parse a .ical file, and that library is exported to a .jar.
In my Android Project i have imported and added to the build path my generated .jar from my library that includes some jars to make my library work.
But when i run my application it just crashes and i get this on the LogCat:
E/AndroidRuntime(14382): java.lang.NoClassDefFoundError: net.fortuna.ical4j.data.CalendarBuilder
That library (ical4j.jar) is imported on the library buildpath and is exported whith my library (mylibrary.jar)..
You can use One-Jar to help you use a jar file that is dependent on other jar files. Basically you can combine them into one jar file.
Here is a little tutorial to help you.
Just put the content of the one jar into the other jar (combine them). They are just zip files.
Is mylibrary.jar an executable jar file?
If so, you cannot reference external jars.

Accessing external library (jmf) within jar file

We used an external library, specifically jmf.jar (Java Media Framework), for our java application which relies on images captured from the webcam. However, when we tried to package the application into a jar file, the application runs but once we try to access/open the webcam nothing happens.
We are using Eclipse and we used its export feature to create the jar file.
Does anybody know how to solve this?
Did you think to include jmf in the manifest of your jar ? See this link for more explanations here
You don't just need to export your project into a jar file; you need to create an "executable" jar file. This means that the manifest of the jar file is edited appropriately so that the classpath includes all required dependencies and the main class is set correctly.
In recent versions of Eclipse you can use the Runnable JAR File Export Wizard. Have also a look at the Fat Jar Eclipse Plug-in.
If you are using JMF you’ll need to include jmf.jar and jmf.properties in the same directory as the executable jar

Categories