Java NIO

classic Classic list List threaded Threaded
7 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
Reply | Threaded
Open this post in threaded view
|

Re: Java NIO

rkumar
In reply to this post by gpatrick
Java training by SevenMentor Institute in Pune stands out as a premier program for mastering Java programming. Renowned for its industry-focused curriculum, the institute provides in-depth training on core and advanced Java concepts, ensuring learners gain hands-on expertise in object-oriented programming, data structures, web development, and frameworks like Spring and Hibernate. The trainers are experienced professionals who bring real-world insights into the classroom, making the sessions engaging and practical.
SevenMentor emphasizes a project-based approach, enabling students to apply their knowledge to real-time scenarios, thereby building confidence and skills required by the industry. With state-of-the-art facilities and flexible training schedules, including online and classroom options, the institute caters to students and working professionals alike. Their excellent placement support, coupled with resume-building and interview preparation sessions, helps learners secure rewarding job opportunities. For anyone looking to excel in Java, SevenMentor in Pune offers a comprehensive and enriching learning experience.
Visit us:

Visit us:
Java classes in Pune                               
Java training in Pune                       
Java course in Pune