mackworth / cTiVo

TiVo Show Downloads for MacOS
220 stars 36 forks source link

TivoLibre Java requirement #451

Closed pthall closed 3 years ago

pthall commented 3 years ago

cTiVo will not detect the Java Runtime Environment. cTiVo runs /usr/libexec/java_home - which returns output like this when the JRE is installed:

% /usr/libexec/java_home        
Unable to find any JVMs matching version "(null)".
No Java runtime present, try --request to install.

There is no issue when the JDK is installed. It would be helpful if cTiVo documentation made it clear that the Java requirement is specifically the JDK.

My impression is that TivoLibre only requires the JRE, but I haven't tested that theory.

Thanks for making cTiVo and including TivoLibre support. I need TivoLibre for its MPEG2 TS support. MPEG2 PS results in some garbled subtitle files, so I hope that TivoLibre (or some other means of MPEG2 TS support) will continue.

mackworth commented 3 years ago

You are correct. It shouldn’t require the JDK. If you have a command line that I can use to detect both, that would be great!

pthall commented 3 years ago

One idea - the static path cTiVo uses for java /usr/bin/java could be checked with the -version parameter.

Here's an example when the JDK is present:

$ java -version
openjdk version "11.0.10" 2021-01-19 LTS
OpenJDK Runtime Environment Corretto-11.0.10.9.1 (build 11.0.10+9-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.10.9.1 (build 11.0.10+9-LTS, mixed mode)

$ ls -l /usr/bin/java
lrwxr-xr-x  1 root  wheel  74 Aug  3  2020 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java

If you don't have the JRE or JDK, usr/bin/java will still be present but checking the version looks like this:

$ java -version
No Java runtime present, requesting install.

$ which java
/usr/bin/java

$ ls -l /usr/bin/java
lrwxr-xr-x  1 root  wheel  74 Sep 14 18:23 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
mackworth commented 3 years ago

Thanks, I've changed the check in the next version to /usr/bin/java -version and looking for No Java in the returned string. Seems to work fine.

mackworth commented 3 years ago

Finally gotten around to beta of next version. My M1 now says

The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.

So the test is now "No Java" or "Unable to locate"

Let me know if that doesn't work our your system.

mackworth commented 3 years ago

beta release here