I've already asked about some similar things connected with theme above and google a lot, but I still can't find exactly what I want, so here we go:
I want to make library, which will use other libraries. I mean some of javacv's .jar's, which we can find here: javacv site
. Some of these libraries are 'normal', some of them contains .dll's. I want to create independent .jar file, which could be use together with above .jars in different projects. Classes in this my .jar file will use methods from javacv's .jars. So my 'independent' library will depend on javacv.
In parallel, I'd like to write application, which will use javacv and my library. So I'd like to create 2 projects:
A) Library, which will depend on javacv 's jar's (I should get here .jar, which could be use in other projects together with javacv)
B) Application which will depend on library from A) and javacv's jars
What should I do in Netbeans (or eventually in Eclipse) to organize it in best way? I know, that I probably should use maven / create some maven projects but I don't know a lot about maven ( I can add... dependency :) ).
Related
I'm trying to setup the Scichart libraries using this guide.
The library I downloaded has a structure that looks like this:
I copied the 5 .aar files and the 4 documentation .jar files into the libs folder of the app in Android Studio, like so:
Following a guide I read online (I've never added an external library before) I found that for the documentation to work I'd need to add it as an attachment here:
However, when I right clicked and went to library properties it looked like it already had it - I assume that since the files are in the lib folder in the app they're seen and used.
So, everything should work. The problem is that Android Studio is offering to import one of two classes with the exact same package name but different Gradle packages (? don't know if that's the right term) on the right. Picture:
Why is it doing this? What did I do wrong when adding the library?
Per tutorial (Tutorial 01), the sections
Using Maven (well it's more Gradle)
Using bare SciChart libs
Are mutually exclusive.
If you already referenced their libraries via build.gradle (as described in the tutorial, Using Maven part), you don't need (and don't have) to put JAR(s) inside any folder and then add them to the Module settings, or whatever. Even sources will be pulled down automatically.
What you're doing is creating a local repository, in addition to using the remote one. That's why the duplicated libraries.
I want to create one external jar for Logging Purposes,so that i can import this jar in any java project.But i would like to use the classes and methods of java project in external jar.
Is it possible ?If yes,please help.
I think it's possible from Reverse Engineering,but not able to figure out how to use class and specially methods in external jar.
It is possible, but very bad practice.
You need to import each project into eachother.
Project A imports Project B
and
Project B imports Project A.
I would recommend you to use eclipse and add the projects as source. You can read how to do that here:
Creating a java library with Eclipse
You can read about the bad practice of what you ara about to do here:
Two java libraries importing each other?
There are lots of posts about this already but I have not found one that describes my exact situation. Which is:
I have a preexisting build system that generates a C++ shared library in both .dll and .so format (depends on OS).
The build system also produces a set of java files generated by swig.
I also have a pom.xml file that builds the java source into a package.
What I need is a plugin for maven that simply copies the native shared library into the jar. It would be nice if the native shared library was also loadable from within the jar so clients don't have to manually add it to the library path. This seems like a problem that has been solved before.
I have looked at maven-dependency-plugin. Which seems to be able to copy artifacts that are in a maven repository (not my case). Or if you use an assembly it might be possible. However, if it is possible, it seems overly complicated for what I want to accomplish. I would like to accomplish it with only a pom.xml.
I have also looked at nar-maven-plugin, but this seems like it focuses only on building the native library and adding it to a .nar file. This is not what I need since I can already build the C++ library.
Finally, I looked at one-jar which I got to place the native library inside the jar. However, I was not able to import the classes from within that jar, and the clients of this library will expect to be able to do that.
If what I want is possible and I don't need to install the shared library into my local repository please provide a link or an example of how you accomplished it. If it is not possible, please state why.
After using eclipse i decided to ask this what bugs me the most. When exporting a project to working .jar you have 3 options. Because using extract or package required libraries into jars gives my program a lot of space to have than 3 options, copy required libraries to directory. Now my project has only about 70 kb than 15 mb before. Actually i didn't recognize that not possessing folder with my library classes cause some issues. Why?
I heard from a friend of mine that some thing were not working for him and i send him only jar, than lib.
Is there a difference between exporting types and machines( i poses jdk my friend not only jre)?
Is there a way to check for required essentials libraries or class that are required, check on system and order to download them? Or just download the external lib folder. The most i am interested in detecting missing classes or libraries.
You would have to learn some things but you may want to try using Maven projects. Maven is a Java building tool. One of Maven's most important features is transitive dependencies.
I have a project that uses a lot of external libraries (mostly .jar files). I am using Eclipse Helios Service Release 2.
When something doesn't work, the problem is usually caused by missing jars or some problem with classpath. What I have to do, is to check that all necessary jars are correctly included in my classpath.
The problem is that I have several libraries imported + external jars (in case of libraries, the classpath only points to the directory with the jars) and Eclipse provides no easy way to search for included jars. If there was any kind of function that would work like this: "search for xyz.jar" and find if the jar with given name is already included somewhere, instead of manually controlling this, it would be a great help.
It would also help if Eclipse provided a function to sort all the jars and libraries by name instead of displaying them in the same order they are specified in path (I mean only in the project manager, of course).
So my question: is there an easy way to check these things or do I have to do that manually? I have cca 30 jars to include and cca 300 already there and this is a real pain...
You could use a build environment, such as Maven, to manage your dependencies for you. Then Eclipse does zero thinking on its own and your life becomes far more pleasant (particularly when the time comes to package your code for release).
I couldn't imagine managing 300+ dependencies any other way.