How to use with Neo4j with Java simply using JDK Tools? -


i'm trying use neo4j embedded in java application small project of mine. this, i'm using jdk tools, so, there's no eclipse, net beans or intellij idea.

i've tried follow tutorial supplied neo4j (include neo4j in project) , i'm somehow doing wrong, since doesn't work.

to sum up, i've got small .java file, let's it's composed of bare necessities work , import of org.neo4j

import org.neo4j; // or org.neo4j.*, or else starts  public class application {     // bare necessities work } 

i'm trying compile simple code javac using -classpath specify find neo4j libraries, it's showed in tutorial

javac -g -cp "c:/path/to/libs/neo4j community/jre/lib" application.java 

but each time, compilation fail @ line of import, saying package doesn't exist. , of course, once line erased, compilation succeed.

i've tried move libs inside project's folder, , i've tried download neo4j kernel jar , put inside neo4j's folder , project's folder, but, none of these solutions have worked.

if me, thankful him.

cordially, jaxon

edit : when try compile following command :

javac -g -cp "c:\path\to\libs\neo4j community\jre\lib\*" application.java 

the error stays , 2 warnings appear. don't know if it's related, here errors :

warning: supported source version 'release_7' annotation processor 'org.neo4j.kernel.impl.annotations.serviceprocessor' less -source '1.8' warning: supported source version 'release_7' annotation processor 'org.neo4j.kernel.impl.annotations.documentationprocessor' less -source '1.8' application.java:4: error: package org.neo4j not exist import org.neo4j.*; ^ 1 error 2 warnings 

edit : have program compiles, when run it, there exception crash program. code haven't changed lot, difference import org.neo4j.graphdb.* , org.neo4j.graphdb.factory.*

here exception returned :

exception in thread "main" java.lang.noclassdeffounderror: org/neo4j/graphdb/factory/graphdatabasefactory     @ myapp.connection(myapp.java:18)     @ myapp.<init>(myapp.java:13)     @ myapp.main(myapp.java:8) caused by: java.lang.classnotfoundexception: org.neo4j.graphdb.factory.graphdatabasefactory     @ java.net.urlclassloader.findclass(unknown source)     @ java.lang.classloader.loadclass(unknown source)     @ sun.misc.launcher$appclassloader.loadclass(unknown source)     @ java.lang.classloader.loadclass(unknown source)     ... 3 more 

well understand exception means don't know how solve problem. because according neo4j documentation, graphdatabasefactory in org.neo4j.graphdb.factory. don't know go...

you need use * wildcard specify jar files in lib folder. try this:

javac -g -cp "c:/path/to/libs/neo4j community/jre/lib/*" application.java 

[edit]

of course, must use computer's actual path lib directory. "c:/path/to/libs/neo4j community/jre/lib/*" example.

also, warnings following (which mean parts of library annotated indicate support java 1.7, compiling java 1.8) may not prevent resulting .class files running properly:

warning: supported source version 'release_7' annotation processor 'org.neo4j.kernel.impl.annotations.serviceprocessor' less -source '1.8' 

however, if want sure, 1 way rid of warning downgrade jdk 1.7.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -