FAQ  •  Register  •  Login

Running groovy from command line

<<

brainforge.uk

Serviio newbie

Posts: 7

Joined: Sat Jan 28, 2017 5:19 pm

Post Sat Jan 28, 2017 7:55 pm

Running groovy from command line

I found and installed groovy v2.4.7
When I run a serviio groovy file I get a message which suggests I should be using groovy v1.8.6
The serviio documentation link to groovy does not work - http://groovy.codehaus.org/
I got groovy v2.4.7 from http://groovy-lang.org/download.html

On Windows 10 I ran the following:

  Code:
c:\Program Files\Serviio\plugins> SET SERVIIO_CLASSPATH="C:\Program Files\Serviio\lib\commons-codec.jar;C:\Program Files\Serviio\lib\commons-imaging.jar;C:\Program Files\Serviio\lib\commons-io.jar;C:\Program Files\Serviio\lib\commons-jxpath.jar;C:\Program Files\Serviio\lib\commons-lang.jar;C:\Program Files\Serviio\lib\concurrent.jar;C:\Program Files\Serviio\lib\derby.jar;C:\Program Files\Serviio\lib\freemarker.jar;C:\Program Files\Serviio\lib\groovy-all.jar;C:\Program Files\Serviio\lib\gson.jar;C:\Program Files\Serviio\lib\httpcore.jar;C:\Program Files\Serviio\lib\jaudiotagger.jar;C:\Program Files\Serviio\lib\jcl-over-slf4j.jar;C:\Program Files\Serviio\lib\jcs.jar;C:\Program Files\Serviio\lib\jdom.jar;C:\Program Files\Serviio\lib\jnat-pmplib.jar;C:\Program Files\Serviio\lib\jul-to-slf4j.jar;C:\Program Files\Serviio\lib\log4j.jar;C:\Program Files\Serviio\lib\lucene-analyzers-common.jar;C:\Program Files\Serviio\lib\lucene-core.jar;C:\Program Files\Serviio\lib\org.restlet.ext.gson.jar;C:\Program Files\Serviio\lib\org.restlet.ext.net.jar;C:\Program Files\Serviio\lib\org.restlet.ext.xstream.jar;C:\Program Files\Serviio\lib\org.restlet.jar;C:\Program Files\Serviio\lib\padlock.jar;C:\Program Files\Serviio\lib\rome-modules.jar;C:\Program Files\Serviio\lib\rome.jar;C:\Program Files\Serviio\lib\sbbi-upnp.jar;C:\Program Files\Serviio\lib\serviio-client.jar;C:\Program Files\Serviio\lib\serviio-media-browser.jar;C:\Program Files\Serviio\lib\serviio.jar;C:\Program Files\Serviio\lib\slf4j-api.jar;C:\Program Files\Serviio\lib\slf4j-log4j12.jar;C:\Program Files\Serviio\lib\streamflyer-core.jar;C:\Program Files\Serviio\lib\winp.jar;C:\Program Files\Serviio\lib\xstream.jar;"

  Code:
c:\Program Files\Serviio\plugins> "C:\Program Files (x86)\Groovy\Groovy-2.4.7\bin\groovy.exe" -cp %SERVIIO_CLASSPATH% "C:\Program Files\Serviio\plugins\GooglePlus.groovy"

Resulting in the following error message - version incompatibility highlighted.
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Could not instantiate global transform class org.spockframework.compiler.SpockTransform specified at jar:file:/C:/Program%20Files%20(x86)/Groovy/Groovy-2.4.7/lib/spock-core-1.0-groovy-2.4.jar!/META-INF/services/org.codehaus.groovy.transform.ASTTransformation because of exception org.spockframework.util.IncompatibleGroovyVersionException: The Spock compiler plugin cannot execute because Spock 1.0.0-groovy-2.4 is not compatible with Groovy 1.8.6. For more information, see http://versioninfo.spockframework.org
Spock artifact: file:/C:/Program%20Files%20(x86)/Groovy/Groovy-2.4.7/lib/spock-core-1.0-groovy-2.4.jar
Groovy artifact: file:/C:/Program%20Files/Serviio/lib/groovy-all.jar

How can I download v1.8.6 (or v1.8.9 which looks like it should also work).

----------------------------------------------------------------------------------------------------------------------

I've also tried running the version of groovy bundled with serviio as follows, without success...
  Code:
c:\Program Files\Serviio\plugins>java -cp %SERVIIO_CLASSPATH% ..\lib\groovy-all.jar  ".\GooglePlus.groovy"
Error: Could not find or load main class ..\lib\groovy-all.jar


  Code:
c:\Program Files\Serviio\plugins>java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Sun Jan 29, 2017 9:29 pm

Re: Running groovy from command line

This seems like a link to the downloads: https://dl.bintray.com/groovy/maven/
<<

brainforge.uk

Serviio newbie

Posts: 7

Joined: Sat Jan 28, 2017 5:19 pm

Post Fri Feb 17, 2017 10:52 pm

Re: Running groovy from command line

Thanks, found it, looks hopeful. 8-)
Not had time to try it yet.
<<

brainforge.uk

Serviio newbie

Posts: 7

Joined: Sat Jan 28, 2017 5:19 pm

Post Sun Feb 19, 2017 4:55 pm

Re: Running groovy from command line

No success here.
groovy.exe does not exist, tried groovy and groovy.bat

  Code:
C:\Program Files\Serviio\plugins>dir "C:\Program Files (x86)\Groovy\Groovy-1.8.6\bin"
 Volume in drive C is Windows 10
 Volume Serial Number is 5CC9-7925

 Directory of C:\Program Files (x86)\Groovy\Groovy-1.8.6\bin

19/02/2017  16:24    <DIR>          .
19/02/2017  16:24    <DIR>          ..
19/02/2017  16:24               986 grape
19/02/2017  16:24               491 grape.bat
19/02/2017  16:24               972 groovy
19/02/2017  16:24               476 groovy.bat
19/02/2017  16:24           110,971 groovy.icns
19/02/2017  16:24            15,459 groovy.ico
19/02/2017  16:24               839 groovyc
19/02/2017  16:24               500 groovyc.bat
19/02/2017  16:24               818 groovyConsole
19/02/2017  16:24               473 groovyConsole.bat
19/02/2017  16:24               837 groovydoc
19/02/2017  16:24               496 groovydoc.bat
19/02/2017  16:24               926 groovysh
19/02/2017  16:24               584 groovysh.bat
19/02/2017  16:24               899 java2groovy
19/02/2017  16:24               556 java2groovy.bat
19/02/2017  16:24             8,109 startGroovy
19/02/2017  16:24             7,581 startGroovy.bat
              18 File(s)        151,973 bytes
               2 Dir(s)  32,448,643,072 bytes free

C:\Program Files\Serviio\plugins>set ServiioPath="C:\Program Files\Serviio"

C:\Program Files\Serviio\plugins>set GROOVY_HOME="C:\Program Files (x86)\Groovy\Groovy-1.8.6"

C:\Program Files\Serviio\plugins>%GROOVY_HOME%\bin\groovy -cp "%ServiioPath%\lib\serviio.jar;%ServiioPath%\lib\slf4j-api.jar;%ServiioPath%\lib\slf4j-log4j12.jar;%ServiioPath@\lib\log4j.jar;%ServiioPath%\lib\org.restlet.jar" "GooglePlus.groovy"
Files was unexpected at this time.

C:\Program Files\Serviio\plugins>"%GROOVY_HOME%\bin\groovy" -cp "%ServiioPath%\lib\serviio.jar;%ServiioPath%\lib\slf4j-api.jar;%ServiioPath%\lib\slf4j-log4j12.jar;%ServiioPath@\lib\log4j.jar;%ServiioPath%\lib\org.restlet.jar" "GooglePlus.groovy"
'""C:\Program' is not recognized as an internal or external command,
operable program or batch file.

C:\Program Files\Serviio\plugins>"C:\Program Files (x86)\Groovy\Groovy-1.8.6\bin\groovy" -cp "%ServiioPath%\lib\serviio.jar;%ServiioPath%\lib\slf4j-api.jar;%ServiioPath%\lib\slf4j-log4j12.jar;%ServiioPath@\lib\log4j.jar;%ServiioPath%\lib\org.restlet.jar" "GooglePlus.groovy"
Files was unexpected at this time.

C:\Program Files\Serviio\plugins>"C:\Program Files (x86)\Groovy\Groovy-1.8.6\bin\groovy.bat" -cp "%ServiioPath%\lib\serviio.jar;%ServiioPath%\lib\slf4j-api.jar;%ServiioPath%\lib\slf4j-log4j12.jar;%ServiioPath@\lib\log4j.jar;%ServiioPath%\lib\org.restlet.jar" "GooglePlus.groovy"
Files was unexpected at this time.
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Mon Feb 20, 2017 1:19 pm

Re: Running groovy from command line

looks like the problem is with the space in Program FIles.

you will have to encode the space somehow or store the serviio libs in a non-spaced folder. Or it might be the space from the groovy path, not sure which.
<<

brainforge.uk

Serviio newbie

Posts: 7

Joined: Sat Jan 28, 2017 5:19 pm

Post Sat Feb 25, 2017 3:52 pm

Re: Running groovy from command line

Moved Groovy and Serviio to T:, stil not getting anywhere.

I was hoping your Windows example http://wiki.serviio.org/doku.php?id=servio_plugins using GooglePlus.groovy would give me an example to get me started. Moving Serviio and Groovy to T:\ to get rid of the space did not help.

In simple terms the plugin I would like to develop has the following features.
(a) In Serviio console library add an online resource to:
file:///W:/data/sqlbrain.db

(b) Using SQL the plugin will then trawl through the database producing a folder / media file heirarchical list.

The result would be the same as having separate shared folders like this:
c:\myphotos\date1

c:\myphotos\place1

c:\myphotos\event1

The trouble with that is that I have to have 3 copies of the same media - one for the date, another for the place and another for the event.
I don't want to manage that (such as move to Linux and use symbolic links).
The data is already in my database and readily accessible with SQL, so a plugin should not be that difficult a solution.

If you have any suggestions or a working plugin example which will set me on the right path would be useful.
Everything is currently under Windows 10 and would prefer not to go down the domestic Linux / Raspberry PI route.
Thanks.

Examples of my recent attempts using T: drive...

  Code:
T:\Serviio>t:\Groovy\Groovy-1.8.6\bin\groovy.bat -cp lib/serviio.jar:lib/slf4j-api.jar:lib/slf4j-log4j12.jar:lib/log4j.jar:lib/org.restlet.jar plugins/GooglePlus.groovy
The syntax of the command is incorrect.


Tried Groovy debug mode and that did not help.
  Code:
T:\Serviio>set DEBUG=y

T:\Serviio>t:\Groovy\Groovy-1.8.6\bin\groovy.bat -cp lib/serviio.jar:lib/slf4j-api.jar:lib/slf4j-log4j12.jar:lib/log4j.jar:lib/org.restlet.jar plugins/GooglePlus.groovy

T:\Serviio>if "Windows_NT" == "Windows_NT" setlocal

T:\Serviio>set DIRNAME=t:\Groovy\Groovy-1.8.6\bin\

T:\Serviio>if "t:\Groovy\Groovy-1.8.6\bin\" == "" set DIRNAME=.\

T:\Serviio>"t:\Groovy\Groovy-1.8.6\bin\\startGroovy.bat" "t:\Groovy\Groovy-1.8.6\bin\" groovy.ui.GroovyMain -cp lib/serviio.jar:lib/slf4j-api.jar:lib/slf4j-log4j12.jar:lib/log4j.jar:lib/org.restlet.jar plugins/GooglePlus.groovy

T:\Serviio>if "Windows_NT" == "Windows_NT" setlocal enabledelayedexpansion

T:\Serviio>set DIRNAME=t:\Groovy\Groovy-1.8.6\bin\

T:\Serviio>shift

T:\Serviio>set CLASS=groovy.ui.GroovyMain

T:\Serviio>shift

T:\Serviio>if exist "C:\Users\Jonathan/.groovy/preinit.bat" call "C:\Users\Jonathan/.groovy/preinit.bat"

T:\Serviio>set COMMAND_COM="cmd.exe"

T:\Serviio>if exist "C:\WINDOWS\system32\cmd.exe" set COMMAND_COM="C:\WINDOWS\system32\cmd.exe"

T:\Serviio>if exist "C:\WINDOWS\command.com" set COMMAND_COM="C:\WINDOWS\command.com"

T:\Serviio>set FIND_EXE="find.exe"

T:\Serviio>if exist "C:\WINDOWS\system32\find.exe" set FIND_EXE="C:\WINDOWS\system32\find.exe"

T:\Serviio>if exist "C:\WINDOWS\command\find.exe" set FIND_EXE="C:\WINDOWS\command\find.exe"

T:\Serviio>if not "C:\Program Files\Java\jdk1.8.0_74" == "" goto have_JAVA_HOME

T:\Serviio>if "4" == "\" SET JAVA_HOME=C:\Program Files\Java\jdk1.8.0_7

T:\Serviio>"C:\WINDOWS\system32\cmd.exe" /C DIR "C:\Program Files\Java\jdk1.8.0_74"   2>&1  | "C:\WINDOWS\system32\find.exe" /I /C "C:\Program Files\Java\jdk1.8.0_74"  1>nul

T:\Serviio>if not errorlevel 1 goto valid_JAVA_HOME_DIR

T:\Serviio>set JAVA_EXE=C:\Program Files\Java\jdk1.8.0_74\bin\java.exe

T:\Serviio>if exist "C:\Program Files\Java\jdk1.8.0_74\bin\java.exe" goto valid_JAVA_HOME

T:\Serviio>if exist "C:\Program Files\Java\jdk1.8.0_74\lib\tools.jar" set TOOLS_JAR=C:\Program Files\Java\jdk1.8.0_74\lib\tools.jar

T:\Serviio>if ""T:\Groovy\Groovy-1.8.6"" == "" set GROOVY_HOME=t:\Groovy\Groovy-1.8.6\bin\..
The syntax of the command is incorrect.

T:\Serviio>if """=="\" SET GROOVY_HOME="T:\Groovy\Groovy-1.8.6
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Sun Feb 26, 2017 1:05 pm

Re: Running groovy from command line

did you set some env variables yourself? it looks like the .bat file is either wrong or something in your environment is (the double quotes seem weird)


What if you type just groovy.bat

Return to Serviio Support & Help

Who is online

Users browsing this forum: No registered users and 48 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.