srisar
srisar

Reputation: 1571

How to use NIO and JFilechooser in Java 7?

I am using Java 7, NIO package rather than IO, but JFileChooser uses File class to getSelectedFile(), but in NIO there is only Path class. How can I use NIO classes with JFileChooser ?

Upvotes: 2

Views: 1078

Answers (3)

Andrew Thompson
Andrew Thompson

Reputation: 168825

Path path = selectedFile.toPath();

Upvotes: 2

IPSA AI Learners
IPSA AI Learners

Reputation: 31

yourPath = yourJFileChooser.getSelectedFile().toPath();

Upvotes: 3

Harmeet Singh
Harmeet Singh

Reputation: 2616

try this :

File file = Paths.get(URI).toFile();

Upvotes: 0

Related Questions