jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • groovy
  • GROOVY-2828

Command line option -cp does not work: "Error: no argument for:c"

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 1.5.4, 1.5.6, 1.6-beta-1
  • Fix Version/s: 1.5.7, 1.6-beta-2
  • Component/s: None
  • Labels:
    None
  • Environment:
    Windows XP

    Groovy Version: 1.6-beta-1 JVM: 1.5.0_15
    Groovy Version: 1.5.6 JVM: 1.5.0_15-b04
    Groovy Version: 1.5.4 JVM: 1.5.0_15-b04

Description

Setting classpath per command line option when starting script with groovy command (.bat file version) does not work, neither with -cp nor with -classpath:

D:\Workarea\TestSource>groovy -cp ..\Classes MyAppTest.groovy
error: no argument for:c
usage: groovy [options] [args]
options:
  -p                               process files line by line and print result
                                   (see also -n)
  -D,--define <name=value>         define a system property
  -a,--autosplit <splitPattern>    split lines using splitPattern (default '\s')
                                   using implicit 'split' variable
  -c,--encoding <charset>          specify the encoding of the files
  -d,--debug                       debug mode will print out full stack traces
  -e <script>                      specify a command line script
  -h,--help                        usage information
  -i <extension>                   modify files in place; create backup if
                                   extension is given (e.g. '.bak')
  -l <port>                        listen on a port and process inbound lines
  -n                               process files line by line using implicit
                                   'line' variable
  -v,--version                     display the Groovy and JVM versions
D:\Workarea\TestSource>groovy -classpath ..\Classes MyAppTest.groovy
Caught: java.lang.IllegalArgumentException: D:\Workarea\Classes (D:\Workarea\Classes) is a directory not a Groovy source file.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Paul King added a comment - 15/May/08 8:41 PM

does --classpath work? It appears to for me.

Show
Paul King added a comment - 15/May/08 8:41 PM does --classpath work? It appears to for me.
Hide
Permalink
Dirk Detering added a comment - 16/May/08 1:45 AM

You're right, that way it works for 1.5.4 and 1.5.6

But for 1.6-beta-1 I got this result:

D:\Workarea\TestSource>groovy --classpath ..\Classes MyAppTest.groovy
Caught: java.io.FileNotFoundException: D:\Workarea\TestSource--classpath (D:\Workarea\TestSource--classpath)

Show
Dirk Detering added a comment - 16/May/08 1:45 AM You're right, that way it works for 1.5.4 and 1.5.6 But for 1.6-beta-1 I got this result: D:\Workarea\TestSource>groovy --classpath ..\Classes MyAppTest.groovy Caught: java.io.FileNotFoundException: D:\Workarea\TestSource--classpath (D:\Workarea\TestSource--classpath)
Hide
Permalink
Paul King added a comment - 21/May/08 8:47 AM

Should be fixed in trunk - needs a little bit more manual testing ...

Show
Paul King added a comment - 21/May/08 8:47 AM Should be fixed in trunk - needs a little bit more manual testing ...
Hide
Permalink
Paul King added a comment - 29/May/08 12:44 AM

merged onto 1.5.7 branch

Show
Paul King added a comment - 29/May/08 12:44 AM merged onto 1.5.7 branch
Hide
Permalink
Christian Hartmann added a comment - 02/Dec/08 8:18 AM

Hello all

I have installed Groovy Version: 1.5.7 JVM: 1.6.0_07 on my computer.
I have a script that I would like to run with groovy setNamenSkalierung.groovy, but for this script I need a PostgeSQL driver so I added the jar file with a classpath option "groovy -cp ../../lib/postgresql-8.2-505.jdbc3.jar:. setNamenSkalierung.groovy".
No it dos not load this jar at all.
I rayed to load laod it with the ~/.groovy/lib, with "C:\Programme\Groovy\Groovy-1.5.7\embeddable" and with all kind of writing versions in the command string "groovy -cp ../../lib/postgresql-8.2-505.jdbc3.jar setNamenSkalierung.groovy, groovy -classpath ../../lib/postgresql-8.2-505.jdbc3.jar:. setNamenSkalierung.groovy, etc."

When ever I do a
println "********************************************"
System.properties.each{println it}
println "********************************************"

println "********************************************"
System.env.each{println it}
println "********************************************"

there is no effect on the "java.class.path=C:\Programme\Groovy\Groovy-1.5.7\lib\groovy-1.5.7.jar" variable.

So it would be my bett that this bug is still not fixed.

Hope to help you with this comment.

Greetings Chris

Show
Christian Hartmann added a comment - 02/Dec/08 8:18 AM Hello all I have installed Groovy Version: 1.5.7 JVM: 1.6.0_07 on my computer. I have a script that I would like to run with groovy setNamenSkalierung.groovy, but for this script I need a PostgeSQL driver so I added the jar file with a classpath option "groovy -cp ../../lib/postgresql-8.2-505.jdbc3.jar:. setNamenSkalierung.groovy". No it dos not load this jar at all. I rayed to load laod it with the ~/.groovy/lib, with "C:\Programme\Groovy\Groovy-1.5.7\embeddable" and with all kind of writing versions in the command string "groovy -cp ../../lib/postgresql-8.2-505.jdbc3.jar setNamenSkalierung.groovy, groovy -classpath ../../lib/postgresql-8.2-505.jdbc3.jar:. setNamenSkalierung.groovy, etc." When ever I do a println "********************************************" System.properties.each{println it} println "********************************************" println "********************************************" System.env.each{println it} println "********************************************" there is no effect on the "java.class.path=C:\Programme\Groovy\Groovy-1.5.7\lib\groovy-1.5.7.jar" variable. So it would be my bett that this bug is still not fixed. Hope to help you with this comment. Greetings Chris
Hide
Permalink
Paul King added a comment - 03/Dec/08 5:43 AM

The java.class.path property is the classpath before the Groovy classpath infrastructure does its thing. Can you try something like this:

groovy -cp C:\Downloads\postgresql.org\postgresql-8.3-604.jdbc3.jar -e "println org.postgresql.Driver"

You should get something like:

class org.postgresql.Driver
Show
Paul King added a comment - 03/Dec/08 5:43 AM The java.class.path property is the classpath before the Groovy classpath infrastructure does its thing. Can you try something like this:
groovy -cp C:\Downloads\postgresql.org\postgresql-8.3-604.jdbc3.jar -e "println org.postgresql.Driver"
You should get something like:
class org.postgresql.Driver

People

  • Assignee:
    Paul King
    Reporter:
    Dirk Detering
Vote (0)
Watch (0)

Dates

  • Created:
    15/May/08 8:24 AM
    Updated:
    03/Dec/08 5:43 AM
    Resolved:
    29/May/08 12:44 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.