Java NIO

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Java NIO

gpatrick
When trying to use NIO I am getting this:

# nrc p2.nrx
NetRexx portable processor, version NetRexx 3.02, build 172-20130625-1742
Copyright (c) RexxLA, 2011,2013.  All rights reserved.
Parts Copyright (c) IBM Corporation, 1995,2008.
Program p2.nrx
    function main(String[])
 6 +++ p = Paths.get("/tmp/one")
   +++           ^^^
   +++ Error: The method 'get(java.lang.String)' cannot be found in class 'java.nio.file.Paths' or a superclass
Compilation of 'p2.nrx' failed [one error]


This is the simple test code:
# cat p2.nrx
import java.nio.file.Path
import java.nio.file.Paths

method main(args=String[]) public static
p = Paths.get("/tmp/one")

This is my Java version:
# java -version
java version "1.7.0_09-icedtea"
OpenJDK Runtime Environment (rhel-2.3.4.1.el6_3-x86_64)
OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode)

Why is it failing?
Reply | Threaded
Open this post in threaded view
|

Re: Java NIO

alansam
The compiler is telling the truth, there is no Paths.get(String) method.  The nearest is Paths.get(String, String ...) and NetRexx doesn't support the ... syntax yet.  You can however simulate the ... syntax by providing an array instead.

Try this - note it's a binary method so it treats strings a String instead of Rexx objects (includes the other get method Paths.get(URI) too):

/* NetRexx */
options replace format comments java crossref symbols binary

import java.nio.file.

RexxMain(arg)
return

method RexxMain(arg) public static binary
  do
    p = Paths.get('/tmp/one', [''])
    say p.toString
    say

    p = Paths.get(URI('file:///tmp/one'))
    say p.toString
    say
  catch ex = Exception
    ex.printStackTrace
  end
  return

Alan.


On 1 November 2013 04:50, gpatrick <[hidden email]> wrote:
When trying to use NIO I am getting this:

# nrc p2.nrx
NetRexx portable processor, version NetRexx 3.02, build 172-20130625-1742
Copyright (c) RexxLA, 2011,2013.  All rights reserved.
Parts Copyright (c) IBM Corporation, 1995,2008.
Program p2.nrx
    function main(String[])
 6 +++ p = Paths.get("/tmp/one")
   +++           ^^^
   +++ Error: The method 'get(java.lang.String)' cannot be found in class
'java.nio.file.Paths' or a superclass
Compilation of 'p2.nrx' failed [one error]


This is the simple test code:
# cat p2.nrx
import java.nio.file.Path
import java.nio.file.Paths

method main(args=String[]) public static
p = Paths.get("/tmp/one")

This is my Java version:
# java -version
java version "1.7.0_09-icedtea"
OpenJDK Runtime Environment (rhel-2.3.4.1.el6_3-x86_64)
OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode)

Why is it failing?




--
View this message in context: http://ibm-netrexx.215625.n3.nabble.com/Java-NIO-tp4026829.html
Sent from the ibm-netrexx mailing list archive at Nabble.com.

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/




--
Can't tweet, won't tweet!

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Alan

--
Needs more cowbell.
Reply | Threaded
Open this post in threaded view
|

Re: Java NIO

Marc Remes-2
In reply to this post by gpatrick
Try

p = Paths.get("/tmp/one", ["".toString])

to comply to the class signature Paths.get(String first, String... more)

Pass the empty array for ...

On 11/01/2013 12:50 PM, gpatrick wrote:

> When trying to use NIO I am getting this:
>
> # nrc p2.nrx
> NetRexx portable processor, version NetRexx 3.02, build 172-20130625-1742
> Copyright (c) RexxLA, 2011,2013.  All rights reserved.
> Parts Copyright (c) IBM Corporation, 1995,2008.
> Program p2.nrx
>      function main(String[])
>   6 +++ p = Paths.get("/tmp/one")
>     +++           ^^^
>     +++ Error: The method 'get(java.lang.String)' cannot be found in class
> 'java.nio.file.Paths' or a superclass
> Compilation of 'p2.nrx' failed [one error]
>
>
> This is the simple test code:
> # cat p2.nrx
> import java.nio.file.Path
> import java.nio.file.Paths
>
> method main(args=String[]) public static
> p = Paths.get("/tmp/one")
>
> This is my Java version:
> # java -version
> java version "1.7.0_09-icedtea"
> OpenJDK Runtime Environment (rhel-2.3.4.1.el6_3-x86_64)
> OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode)
>
> Why is it failing?
>
>
>
>
> --
> View this message in context: http://ibm-netrexx.215625.n3.nabble.com/Java-NIO-tp4026829.html
> Sent from the ibm-netrexx mailing list archive at Nabble.com.
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
>
>


--

Marc

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Java NIO

Marc Remes-2
> class signature

read: class' method signature

--

Marc

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Java NIO

gpatrick
In reply to this post by alansam
Thank you
Reply | Threaded
Open this post in threaded view
|

Re: Java NIO

gpatrick
In reply to this post by Marc Remes-2
Thank you