LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   how to run the java applications jar file from the terminal (http://www.linuxquestions.org/questions/programming-9/how-to-run-the-java-applications-jar-file-from-the-terminal-4175467570/)

rohaanembedded 06-27-2013 07:28 AM

how to run the java applications jar file from the terminal
 
Dear sir,

how to run the java applications jar file from the terminal. i have to pass the vm arguements also

my main class name is
Code:

org.first.ivb.application.SampleWindow
and my VM arguements are,

Code:

-Djava.library.path="${workspace_loc}/SampleApp/resources:${env_var:PATH}"
please help me in this

Thanks & Regards
Rohaan

JohnGraham 06-27-2013 12:38 PM

The main class should be defined in the JAR - you shouldn't have to pass it in. Try something like:

Code:

java -Djava.library.path="${workspace_loc}/SampleApp/resources:${env_var:PATH}" -jar path/to/archive.jar
If that doesn't work, post the error you get.

rohaanembedded 06-28-2013 01:04 AM

Dear sir,

I did the thing as u suggested and entered the command like above for vm arguements but i a m still getting the error of not loading JNI lib error

i am pasting my error,


Code:

Did not load library
java.lang.UnsatisfiedLinkError: no SampleJNI in java.library.path
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1681)
        at java.lang.Runtime.loadLibrary0(Runtime.java:840)
        at java.lang.System.loadLibrary(System.java:1047)
        at org.syntec.ivb.jni.DeviceController.<clinit>(DeviceController.java:15)
        at org.syntec.ivb.application.SampleWindow.main(SampleWindow.java:52)
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: no SampleJNI in java.library.path
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1681)
        at java.lang.Runtime.loadLibrary0(Runtime.java:840)
        at java.lang.System.loadLibrary(System.java:1047)
        at org.syntec.ivb.jni.InitDevice.<clinit>(InitDevice.java:7)
        at org.syntec.ivb.application.SampleWindow.initialize(SampleWindow.java:92)
        at org.syntec.ivb.application.SampleWindow.<init>(SampleWindow.java:74)
        at org.syntec.ivb.application.SampleWindow$1.run(SampleWindow.java:59)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:226)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:673)
        at java.awt.EventQueue.access$300(EventQueue.java:96)
        at java.awt.EventQueue$2.run(EventQueue.java:634)
        at java.awt.EventQueue$2.run(EventQueue.java:632)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:105)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:643)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:275)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:200)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)


NevemTeve 06-28-2013 02:06 AM

Are you sure you know how to develop and/or use JNI? It is hardly for beginners... for a start, you should have a file called libSampleJni.so in the specied java.library.path path (and a SampleJni.class on the classpath / in one of your jar-files).

rohaanembedded 06-28-2013 02:46 AM

Dear sir

thanks for rply

i have developed the driver layer for small app to control device and i have Java app which runs fine wit it when run in eclipse but i want to make it a deliverable executable which will run on any any other linux machine. but i am getting error of same kind with the .sh i have created utility Jarsplice i have used to create .sh

i dont really know all java but i want to make this app executable on linux machine

please any suggestions or any help do rply me

thanks & Regards
Rohaan

rohaanembedded 06-28-2013 02:58 AM

Dear sir

thanks for rply

i have developed the driver layer for small app to control device and i have Java app which runs fine wit it when run in eclipse but i want to make it a deliverable executable which will run on any any other linux machine. but i am getting error of same kind with the .sh i have created utility Jarsplice i have used to create .sh


i have that libSampleJni.so can i use this and how please let me know.
i dont really know all java but i want to make this app executable on linux machine

please any suggestions or any help do rply me

thanks & Regards
Rohaan


All times are GMT -5. The time now is 06:00 PM.