0

running java samples

asked 2015-01-13 18:12:36 -0700

tab126 gravatar image

My goal is to get a couple of the java samples running. Perhaps get a windows chat client talking with a sample linux chat client. I have the the linux chat server and client working. Java on windows is proving more difficult.

I've downloaded the SDK from https://allseenalliance.org/developers/download and imported a project into eclipse. I've got the alljoyn.jar added and alljoyn.dll added (as evidenced by my error messages changing). However, I still get unresolved dependencies:

Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\xxx\workspace\java\JavaSDKDocSignalService\lib\native\alljoyn_java.dll: Can't find dependent libraries
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary1(Unknown Source)
    at java.lang.ClassLoader.loadLibrary0(Unknown Source)
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    at org.alljoyn.bus.samples.Service.<clinit>(Service.java:31)

Using dependency walker ( http://www.dependencywalker.com/ ), I think I need at least msvcp110d.dll and msvcr110d.dll. However, those are debug versions of the jars which I wouldn't expect to need. I do not have Visual Studio installed as https://allseenalliance.org/developers/develop/building/windows/build-source would lead me to believe I need (thought I'm not clear on that as I'm not trying to build the alljoyn product -- just use it).

So I think I'm stuck or misunderstanding what the java library is intended to do. Should I be able to write a small java chat client (and run it on a vanilla windows install with just my java, my jar, and the alljoyn jar/dll)? Or is the java build more intended for android?

Thanks

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2015-01-14 20:26:12 -0700

bspencer gravatar image

updated 2015-01-15 12:16:04 -0700

In order for the java sample applications to execute you must tell Java where to look to find the alljoyn_java.dll. In order to do this in a command prompt navigate to the alljoyn java\jar folder then run 'java -Djava.library.path=..\lib -jar <sample.jar run="" to="" wish="" you="">'</sample.jar>

\java\jar>java -Djava.library.path=..\lib -jar JavaSDKDocMethodsClient.jar

The other way to do this is to add the alljoyn java\lib folder to the windows PATH environment variable.

NOTE: Please ensure that you are using the release version of the libraries for Windows. IE do not use the files under the dbg folder use the files under the -rel of the AllJoyn SDK. Using the Debug files will try to load libraries for Visual Studio and other dependencies which is exactly the error you are seeing.

edit flag offensive delete publish link more

Comments

Comments length limits won't let me properly respond to this. See my answer below.

tab126 ( 2015-01-14 21:07:59 -0700 )edit
0

answered 2015-01-14 21:07:21 -0700

tab126 gravatar image

If I understand the first answer correctly, you're expecting that I'm not including the .dll at all. That error is shown by this clearly wrong invocation:

C:\Users\XXX\workspace\java>java -Djava.library.path=foo -classpath JavaSDKDocSignalService.jar;JavaSDKDocSignalService\lib\jars\alljoyn.jar org.
alljoyn.bus.samples.Service
Exception in thread "main" java.lang.UnsatisfiedLinkError: no alljoyn_java in java.library.path
        at java.lang.ClassLoader.loadLibrary(Unknown Source)
        at java.lang.Runtime.loadLibrary0(Unknown Source)
        at java.lang.System.loadLibrary(Unknown Source)
        at org.alljoyn.bus.samples.Service.<clinit>(Service.java:31)

After going your method (jar up, run from command line), my error is still different:

C:\Users\XXX\workspace\java>java -Djava.library.path=JavaSDKDocSignalService\lib\native -classpath JavaSDKDocSignalService.jar;JavaSDKDocSignalSe
rvice\lib\jars\alljoyn.jar org.alljoyn.bus.samples.Service
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\XXX\workspace\java\JavaSDKDocSignalService\lib\native\alljoyn_java.dll: Can't
 find dependent libraries
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary1(Unknown Source)
        at java.lang.ClassLoader.loadLibrary0(Unknown Source)
        at java.lang.ClassLoader.loadLibrary(Unknown Source)
        at java.lang.Runtime.loadLibrary0(Unknown Source)
        at java.lang.System.loadLibrary(Unknown Source)
        at org.alljoyn.bus.samples.Service.<clinit>(Service.java:31)

C:\Users\XXX\workspace\java>ls JavaSDKDocSignalService\lib\native
API-MS-Win-Core-Kernel32-Private-L1-1-1.dll  alljoyn_java.exp  api-ms-win-core-privateprofile-l1-1-1.dll  msvcp110d.dll
alljoyn_java.dll                             alljoyn_java.lib  api-ms-win-service-private-l1-1-1.dll      msvcr110d.dll

The ls shows that the dll is there. I think that .dll has been linked against other windows files, by I'm not a windows programming guy, so I'm out of my depth. I'm hoping this more clearly demonstrates the issue.

edit flag offensive delete publish link more

Comments

What version of windows are you using? Also are you using the debug or release version? If you are using debug please switch to release.

bspencer ( 2015-01-15 12:02:06 -0700 )edit

Window 8.1

tab126 ( 2015-01-15 12:05:17 -0700 )edit

https://allseenalliance.org/releases/alljoyn/14.12/alljoyn-14.12.00-win7x64vs2013-sdk.zip from https://allseenalliance.org/developers/download. I don't see any distinction between debug/release versions.

tab126 ( 2015-01-15 12:14:17 -0700 )edit

I just reproduced this when using the debug version. I updated my answer. Under the windows sdk package you will find two folders inside a XYZ-dbg and XYZ-rel. You must use the -rel files otherwise you will have the issue you noticed.

bspencer ( 2015-01-15 12:16:57 -0700 )edit

Thanks. I'll check that tonight.

tab126 ( 2015-01-15 12:35:27 -0700 )edit
Login/Signup to Answer

Question Tools

Follow
1 follower

Stats

Asked: 2015-01-13 18:12:36 -0700

Seen: 654 times

Last updated: Jan 15 '15