Hi there,

I'm completely new to Java.

I am trying to use import in a project, but despite using what I think is the right code, my application fails to build.

When I build my app, it builds and runs fine, but I want to use JFileChooser, so add this line of code to my program, it is the very first line of code in my app:

import javax.swing.JFileChooser;

Now when I try to build it fails. If I comment it out it does build.

Do I have to download JFileChooser and link it into my project or something similar?

I've never imported a package before, searching Google shows lots of use of the import keyword, but I don't see anything about how the IDE/Compiler locates the package in the first place, if that makes sense.

Thanks very much for any help :)

Edited by Carrots: n/a

5 Years
Discussion Span
Last Post by Carrots

Ah, I've sorted it, seems import statements must be between the package and class declarations.

Hope this helps someone.

Edited by Carrots: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.