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 :)

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

Hope this helps someone.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.