EDIT This question is not about how to solve dependencies using Ant / Maven / Gradle or whatnots.
I'm trying to use Neo4j and I'm a bit confused by the docs as to what I need to embed a very simple "Hello, world!" Neo4j example in an app.
I've read in several places that Neo4j was lightweight and that only one (and now two) jars where needed.
For example here: http://highscalability.com/neo4j-graph-database-kicks-buttox
we can read: "Small footprint. Neo4j is a single <500k jar with one dependency (the Java Transaction API)."
This is precisely one of the reason I'm interested in Neo4j to embed it...
So I downloaded the community edition (GPL) of Neo4j and read the explanation here:
http://docs.neo4j.org/chunked/stable/tutorials-java-embedded-setup.html
which says: "Extract a Neo4j download zip/tarball, and use the jar files found in the lib/ directory."
Now that's more than concise and I've found old messages saying that the "wording was changed". At one point all that Neo4j needed was one jar apparently (which is one of the reason I was interested in embedding Neo4j btw). But now apparently it's two, because there's a dependency on some Java Transaction API (which one? a .jar shipped with neo4j?)
The problem is that if I look in that lib/ dir I've got quite some things:
1115454 lib/neo4j-kernel-1.6.1.jar
153707 lib/neo4j-graph-algo-1.6.1.jar
222791 lib/neo4j-shell-1.6.1.jar
8865464 lib/scala-library-2.9.0-1.jar
43530 lib/neo4j-jmx-1.6.1.jar
590503 lib/neo4j-kernel-1.6.1-tests.jar
23954 lib/neo4j-community-1.6.1.jar
28023 lib/neo4j-udc-1.6.1.jar
1517975 lib/neo4j-cypher-1.6.1.jar
51662 lib/neo4j-graph-matching-1.6.1.jar
16030 lib/geronimo-jta_1.1_spec-1.1.1.jar
143177 lib/neo4j-lucene-index-1.6.1.jar
1466301 lib/lucene-core-3.5.0.jar
118875 lib/server-api-1.6.1.jar
92850 lib/org.apache.servicemix.bundles.jline-0.9.94_1.jar
And in system/lib:
27461 system/lib/blueprints-neo4j-graph-1.1.jar
72650 system/lib/jettison-1.3.jar
628626 system/lib/rrd4j-2.0.7.jar
17985 system/lib/asm-analysis-3.2.jar
177174 system/lib/jetty-util-6.1.25.jar
109043 system/lib/commons-io-1.4.jar
755981 system/lib/neo4j-server-1.6.1.jar
35910 system/lib/gremlin-java-1.4.jar
46367 system/lib/jsr311-api-1.1.1.jar
36551 system/lib/asm-util-3.2.jar
206035 system/lib/commons-beanutils-core-1.8.0.jar
227122 system/lib/jackson-core-asl-1.8.3.jar
33094 system/lib/asm-commons-3.2.jar
17308 system/lib/jcl-over-slf4j-1.6.1.jar
21878 system/lib/asm-tree-3.2.jar
12359 system/lib/log4j-over-slf4j-1.6.1.jar
.
. (skipped a few jars from system/lib here)
.
If my Emacs-fu is strong enough the jars above weight at nearly 17 MB (not that "embeddable")... And I didn't even paste all the jars from system/lib/.
So what is the minimum number of .jar (and which are they) do I need so that I can embed Neo4j and run a simple "Hello, world!" example?
I'm confused by the official doc saying: "... use the jar files found in the lib/ directory".
Surely I don't need all of them right?
Basically, you need only neo4j-kernel-1.6.1.jar (and the mentioned transaction API geronimo-jta_1.1_spec).
However, this will give you only the basic functionality. If you want to use other parts, like indexing, querying, management tools, etc., you would need other jars.
The absolute minimum to run the kernel is
neo4j-kernel.jar
jta.jar
The rest is Cypher, Lucene indexing and other stuff.
Related
I am preparing to use jdbc for the first time and am in the process of installing the jdbc driver for MySQL.
However, it is unclear to me which of these files to move to the WEB_INF/lib folder in Eclipse. They both seem to contain the same content and are included together in the downloaded zip file for the MySQL connector.
I have searched everywhere but have been unable to find any documentation to explain which of these files to use.
I thought you were joking, but I just downloaded the zip from https://dev.mysql.com/downloads/connector/j/ and, indeed, it contains both.
The mysql-connector-java-5.1.46.jar and mysql-connector-java-5.1.46-bin.jar are binary identical, except for the META-INF/INDEX.LIST (which contains the actual jar filename). I have unzipped both and compared them using kdiff3.
In short: you can use either: whatever you prefer.
This change is mentioned in CHANGES as:
- Fix for Bug#27231383, PROVIDE MAVEN-FRIENDLY COMMERCIAL PACKAGES WITHOUT "-BIN".
Interestingly, there is no bug 27231383 in the MySQL bug tracker (the number is too high for the 'normal' bugs listed), so maybe it is from another system within Oracle.
In addition, the online Connector/J 5.1.46 release notes mentions:
The bundle for Connector/J 5.1 delivered by Oracle now contains an
additional jar package with the name mysql-connector-java-5.1.ver.jar
(mysql-connector-java-commercial-5.1.ver.jar for commercial
bundles). It is identical with the other jar package with the original
package named mysql-connector-java-5.1.ver-bin.jar
(mysql-connector-java-commercial-5.1.ver-bin.jar for commercial
bundles), except for its more Maven-friendly file name. (Bug #27231383)
Presumably, given the closer match to Maven naming conventions, this makes it easier to install the library in local/company Maven repositories (eg if you don't want, or legally can't, use Maven Central).
But to repeat: they are the same, and you can use either one.
Building a spring-boot app, we are depending on a 3rd party jar-file,
that expects to find a properties-file with hardcoded filename (say xyz.properties) on the classpath,
and will read its properties from that.
We need, though, to "switch in" different version of this properties-file, depending on in which environment we deploy the jar-file.
So would need, preferably, to add to the classpath a directory external to the jar-file, where we can put the properties-file.
Googling this, I find other people having similar issue,
but not a simple, clean solution for it.
It seems to me, the spring properties-model assumes you only care abt the property-names and their values
(picking them up from System.getProperties())
and really dont care abt from which property-file each value comes.
This may be fine when building your own code along that model,
but may fit not so well when depending on 3rd party solutions, like our use-case.
The simplest workaround I found is to "explode" the spring jar file,
then copy desired property-files into WEB-INF/classes,
then start with the JarLauncher.
Just wondering if there is a better way, without need to "explode" it?
Is my understanding above correct, or have I just overlooked some spring-feature that already supports this use-case?
Hopefully it still works - but with some trick you can set your own classpath:
java -cp "./conf/:yourBoot.jar" org.springframework.boot.loader.JarLauncher
and then you can place your config in external dir (as you already suggested).
See original question: Add jar file to spring-boot classpath at runtime
I am trying to compare two XML files in Java. I also found the code here
https://docs.oracle.com/database/121/ADXDK/adx_j_diff.htm#ADXDK198
But I could not find the jar file for oracle.xml.diff.DiffOp and oracle.xml.diff.DiffOpReceiver.
Oracle XML Developer's Kit for Java is included with Oracle database. These is no external link for these libraries to download. Look at this Installing XDK. This link will show you where is the jar for XDK located in Oracle Database see Installing Oracle XDK for Java Components.
I found Maven Dependency for Oracle-xdb& Oracle-xsql. Also these is one link which contains oracle.xml.differ.Diff - Jars. I am not sure about the jar given in oracle.xml.differ.Diff - Jars are from which version of Oracle. But, you can checkout them too.
I hope this helps you.
Maybe this is a tricky work around but if this is useful to someone, well just my two cents.
Search for oracle.xml.differ.Diff in findjar.com, then you get the
jar name: xml.jar and xmlcomp.jar
Search for "xmlcomp.jar index of" in google,
then you will get a public route in somepage with the publicated non
restricted jar ready to download.
I got this xml.jar and this xmlcomp.jar, and even this xmlcomp2.jar under oracle/product/11.2 folder. Maybe the link will die over the time, but you can always get the jar doing step 2.
Info for people like me, who are only checking for the Jar:
First of all, please tell that, this is a commercial licence product. That's the reason, we are unable to found the XML.jar in internet. Even in documentation also, they are always mentioning it is under the lib folder. But, you can't get the lib folder directly accessible on internet.
I do not find a good tutorial on integrating gilead for GWT with hibernate. I miss the step what jar files to include in my application.
Background:
There is some example source code at:
http://code.google.com/webtoolkit/articles/using_gwt_with_hibernate.html to be found here, but I do not see that the same jars are used in the downloadable files from the gilead download location.
A little trial and error resembles that I need the following jars:
From gilead:
gilead-core-1.3.2.1839.jar
gilead4gwt-1.3.2.1839.jar
gilead-hibernate-1.3.2.1839.jar
beanlib-hibernate-5.0.2beta.jar
beanlib-5.0.2beta.jar
From Hibernate:
cgib-full-2.0.2.jar
log4j-1.2.9.jar
(or similar with a different version number).
I'm using JNA and Java but I think this question affects any native-to-nonnative bridge.
I have a Java application which relies on lib1.dylib, and lib1.dylib relies on lib2.dylib.
I want to put everything inside of my .app file on Mac. I can easily put lib1.dylib inside and set java.classpath (or NativeLibrary.addSearchPath()) to tell the JVM where to find lib1.dylib. The trouble is, I don't know how to communicate that lib1.dylib's dependencies are also in the location I provided. The result is that lib1 is loaded fine, but then lib2 can't be found since it's not in the operating system's library path.
Anyone know how I can overcome this problem? I imagine it must come up plenty in big projects with large numbers of shared libraries.
I've come across this problem before, and have just run into it again today. You may be able to get around it by adding the VM argument "-Djava.library.path=/path/to/other/libs", but I seem to remember Java only uses that to search for the intial library and then uses the system PATH to look for any dependencies.
A few solutions I've tried before:
1) Use System.load(absolutePath) on the dependent library before loading your library. Doesn't make your program ultra-portable though, unless you always know where that library is going to be.
2) In a case where lib1 depends on lib2, I actually used SetCurrentDirectory (Windows, not sure of the Mac equivalent) in the native code before it linked to any of the dependent libs, and that seemed to work. Again, requires knowing where the other libs are.
3) On Windows, could dump the dependent libraries in c:\windows\system32, and it finds them.
A few helpful posts on a similar topic (Windows-specific, but I think the problem is the same):
http://www.realityinteractive.com/rgrzywinski/archives/000219.html
http://www.velocityreviews.com/forums/t387618-jni-library-path.html
I've found a solution for MacOSX based on the idea in (2) from Stew:
Using Mac's JarBundler (or the Ant task of the same name) set the workingdirectory variable to $JAVAROOT and make sure your dylibs are in the Contents/Resources/Java part of the .app. If you do this the dynamic linker will find all the dependency dylibs because it will be the present directory. Java will also find the original dylib (the one that has all the dependencies) for the same reason.
Ant code:
<target name="package_mac_app" depends="package_jar, compile_native" description="bundle the runnable jar into a Mac Application -- requires JarBundler ANT Task">
<taskdef name="jarbundler" classname="net.sourceforge.jarbundler.JarBundler"/>
<echo message="CREATING MAC .app EXECUTABLE"/>
<jarbundler dir="${dist}"
name="${appname}"
mainclass="myPackage.myMainClass"
icon="${icon_location}"
jvmversion="1.5+"
infostring="${appname}"
shortname="${appshortname}"
bundleid="${com.mycompany.mydepartment.myprogram}"
jar="${run_jar_location}"
workingdirectory="$JAVAROOT">
<javafilelist dir="${dylib_location}" files="my-lib.dylib"/>
<javafilelist dir="${dylib_location}" files="dependent-lib.dylib"/>
</jarbundler>
</target>