Looks like CLASSPATH env variable is ignored on this Linux distribution side.
You should refer to basic documentation from Oracle (JRE/JDK owner) or use
ignite.sh script in the following way:
add MAIN_CLASS env variable referring to Demo class (export
MAIN_CLASS=org.apache.ignite.schema.Demo)
add ignite-examples jar into {apache}/libs folder
execute ignite.sh script. Refer to the source of ignite.sh for more details on
how the classpath is prepared and MAIN_CLASS is used
—
Denis
> On Sep 12, 2016, at 4:11 PM, Abhishek Jain <[email protected]>
> wrote:
>
> Thanks Denis for your quick response. Our requirement is to make it work in
> the linux command line. The method mentioned in the Automatic Persistence
> page, is to import the pom.xml from the IDE and execute the Demo.java. With
> Eclipse in Windows is working. To take it to the next step I am trying to
> build and execute from the linux, where the jar file is creating but NOT able
> to execute the Demo application.
>
> I hope you sugested to add the <ignite_home>/libs folder as the class path,
> that I had already included (as part of the environment variable CLASSPATH)
> and checked which is giving the "no main menifest attribute" error, please
> see my previous post for the console output.
>>>
>>> [root@dbtestvm1 target]# echo $CLASSPATH
>>> /root/ignite/apache-ignite-fabric-1.6.0-bin/libs:/usr/java/default/jre/lib/
>>> [root@dbtestvm1 target]#
>>> [root@dbtestvm1 target]# java -jar ignite-examples-1.6.0.jar
>>> org.apache.ignite.schema.Demo
>>> no main manifest attribute, in ignite-examples-1.6.0.jar
>
>
> Please correct me if I misunderstood your suggestion.
>
> Regards
> Abhishek
>
>
>
> On Mon, Sep 12, 2016 at 5:02 PM, Denis Magda <[email protected]
> <mailto:[email protected]>> wrote:
> Alternatively, you can follow this guide [1] that relies on
> ignite-schema-import.sh script that does all the work for you.
>
> [1] https://apacheignite.readme.io/docs/automatic-persistence#demo
> <https://apacheignite.readme.io/docs/automatic-persistence#demo>
>
> —
> Denis
>
>> On Sep 12, 2016, at 2:58 PM, Denis Magda <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>> Hi,
>>
>> You need to add all the libs that are located in “apache-version/libs”
>> folder to your classpath.
>>
>> —
>> Denis
>>
>>> On Sep 12, 2016, at 2:46 PM, Abhishek Jain <[email protected]
>>> <mailto:[email protected]>> wrote:
>>>
>>> Hi,
>>>
>>> Not able to execute the Demo example given in the Automatic Persistence
>>> from the command line in linux. Below is the console output, please let me
>>> know if I am missing out anything. I tried couple of ways below with NO
>>> success
>>>
>>> ===========================================================
>>>
>>> [root@dbtestvm1 target]# java -classpath ignite-examples-1.6.0.jar
>>> org.apache.ignite.schema.Demo
>>> Error: A JNI error has occurred, please check your installation and try
>>> again
>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>> javax/cache/configuration/Factory
>>> at java.lang.Class.getDeclaredMethods0(Native Method)
>>> at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
>>> at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
>>> at java.lang.Class.getMethod0(Class.java:3018)
>>> at java.lang.Class.getMethod(Class.java:1784)
>>> at
>>> sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
>>> at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
>>> Caused by: java.lang.ClassNotFoundException:
>>> javax.cache.configuration.Factory
>>> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
>>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>>> ... 7 more
>>> [root@dbtestvm1 target]#
>>> [root@dbtestvm1 target]#
>>> [root@dbtestvm1 target]#
>>> [root@dbtestvm1 target]#
>>> [root@dbtestvm1 target]# echo $CLASSPATH
>>> /root/ignite/apache-ignite-fabric-1.6.0-bin/libs:/usr/java/default/jre/lib/
>>> [root@dbtestvm1 target]#
>>> [root@dbtestvm1 target]# java -jar ignite-examples-1.6.0.jar
>>> org.apache.ignite.schema.Demo
>>> no main manifest attribute, in ignite-examples-1.6.0.jar
>>> [root@dbtestvm1 target]#
>>> [root@dbtestvm1 target]#
>>>
>>> ==========================================================
>>>
>>> Regards
>>> Abhishek
>>
>
>