openairplay / open-airplay

A collection of libraries for Apple's AirPlay protocol
1.72k stars 184 forks source link

Suggest more information about JMDNS #5

Open pmorch opened 9 years ago

pmorch commented 9 years ago

I got JMDNS working but not without poking around, and I suggest that some more detailed explanation of accomplishing this is mentioned. E.g. I couldn't get this suggested approach to work:

java -jar airplay.jar

Instead this worked for me:

Download jmdns.jar e.g. from this zip file. Then run:

java -cp airplay.jar:jmdns.jar com.jameslow.AirPlay -d

I'm not sure if this is the best way to do it. But some more documentation on this would've been nice.

sparadiso commented 9 years ago

Seconded - running

java -jar build/airplay.jar

or

java -cp lib/jmds.jar -jar build/airplay.jar

result in

Exception in thread "main" java.lang.NoClassDefFoundError: javax/jmdns/JmDNS
    at com.jameslow.AirPlay.search(Unknown Source)
    at com.jameslow.AirPlay.search(Unknown Source)
    at com.jameslow.AirPlay.searchDialog(Unknown Source)
    at com.jameslow.AirPlay.searchDialog(Unknown Source)
    at com.jameslow.AirPlay.main(Unknown Source)
 Caused by: java.lang.ClassNotFoundException: javax.jmdns.JmDNS
    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)

pmorch's solution worked for me, although I openly admit this is probably due to my limited understanding of the Java runtime.

dkinon commented 8 years ago

pmorch's solution worked for me as well with one exception. The jmdns.jar download link provided points to an older version of the jar file that caused me to get the following repeating warnings and never actually get a list of AppleTVs:

<date> AM javax.impl.DNSIncoming readAnswer
WARNING: There was an OPT answer. Not currently handled.  Option code: 65002 data: <hex>

A better source for this jar file is the official release page for jmdns.org: https://github.com/openhab/jmdns/releases . Downloading jmdns-3.4.2.jar fixed the issue I mention above... I have a feeling this is related to the moving target that is AppleTV updates but I don't know for sure.

exussum12 commented 7 years ago

Running ant jarbundle did fix this for me. Though now no errors show and nothing is discovered

brentmsmith commented 7 years ago

So what's the correct way to run the airplay jar file now? Only jar file in master is the jmdns.jar and the above command from @pmorch throws Error: Could not find or load main class com.Jameslow.AirPlay

castarco commented 6 years ago

I'm suffering the same problem as @MachineAlfr , java tells that's unable to find the com.jameslow.AirPlay .

suyashcjoshi commented 3 years ago

go to the java directory and run this command : ant build jarbundle run and that should run the server, though the client (iPhone mirroring is not showing it)