• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

cannot access java.nio.file.Files

 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi. I want to import java.nio.files.Files and java.nio.file.StandardCopyOption packages for copying a file. I am able to run this standalone. Next, I am trying to create an agent in Lotus Notes (using jvm 8). When compiling agent and saving, told java.nio.files does not exist. That is a surprise as I think java.nio.files was new with jvm 7. I then used "edit project" and added rt.jar from the standalone jvm 8 on my workstation. Now I get a "cannot access java.nio.file.Files" compile error. Does anybody have any idea why it cannot access? Thank you so much for reading.
 
Marshal
Posts: 73760
332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's called java.nio.file.Files; you have one S too many.
 
Rancher
Posts: 139
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Note: adding rt.jar as classpath doesn't work. The SE api packages are sealed which means one cannot inject new classes into them.
The rt.jar (the one in the vm base directory) is loaded by the bootstrap classloader. An additional rt.jar in the classpath accessed by a standard runtime classloader then causes errors as the base packages within in are already loaded and sealed off.
I can't come up with an analogy why it's a bad idea to try to copy some base resources around.
 
Campbell Ritchie
Marshal
Posts: 73760
332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please don't edit posts which have been replied to; that can cause confusion about what people are reading. I have reverted the changes.
 
Thomas Griffith
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh, I found the issue, my client Lotus Notes is old, using jvm 6. I thought for sure this version of Notes was on jvm 8. Servers use jvm 8.
 
Campbell Ritchie
Marshal
Posts: 73760
332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That Files class was introduced in Java7.
 
Campbell Ritchie
Marshal
Posts: 73760
332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And well done telling us the correct solution
 
Can you really tell me that we aren't dealing with suspicious baked goods? And then there is this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic