javax.sound problems

I'm trying to do something using javax.sound and Intellij (community edition 11.1.3) is confusing the hell out of me!

When I try to use AudioSystem, it immediately includes the full path to it, but then insists that it cannot resolve the symbol.  The same thing occurred with Clip yesterday, although today it seems happier to accept that it can resolve Clip.

However, even though the code tells me that I haven't caught UnsupportedFormatException, or LineUnavailableException, when I try to write this code, it complains of incompatible types!
Required: java.lang.Throwable
Found: javax.sound.sampled.LineUnavailableException

I'm baffled by this, and when I try to google for an answer, all I find is people asking when to throw a Throwable and when to throw an Exception.

Does anyone have any clues as to what's going on?

Comment actions Permalink

It sounds like it is not correctly resolving the JDK. It's possible the indexes are corrupted. From the menu, select File > Invalidate Caches and then restart IDEA. On restart, IDEA will reindex everything including the JDK (progress will show on the lower status bar right of center). Once the indexing is done, everything should be fine. If not, can you post some screenshots so it's easier to see what is going on. Include a shot of your JDK configuration (File > Project Structure > SDKs).

Comment actions Permalink

OK, I did that, and finally managed to resolve the AudioSystem problem.  I also installed Java7 in case there was something wrong with my Java6.

However now it's complaining that it "cannot resolve symbol 'setMaximumSize' which is a method on JPanel which I've picked in from the options offered.  It also tells me to remove the unnecessary semicolon at the end of this line:

gridPanel.setMaximumSize(new Dimension(110,90));

Even if I pre-create the dimension (Dimension d = new Dimension(110,90);) and then try gridPanel.setMaximumSize(d); it can't recognise the symbol, thinks d is a double, still wants me to remove the 'unnecessary' semicolon at the end of the line.

Personally, I think this community edition has got some serious problems.  Images of my 1.6 and 1.7 SDKs i attached file.

Comment actions Permalink

That is indeed perplexing... I can however assure you that there are not "serious problems" with the community edition. I know a number of people that use that version regularly. I've used as well. And JetBrains is a good company that puts out quality products. They would not release something with fundamental problems. So the issue has to be something specific with your installation or configuration. Let's see if we can figure out what.

Your SDK settings look fine. Given the "strangeness" of the errors you are getting, I keep thinking something has gotten corrupted. All the errors you are getting indicate that IDEA is either not correctly resolving the JDK, or there is an issue with the inspection plug-in. Can IDEA make (Build > Make Project) the project successfully? If so, then we know the JDK is likely OK.  Is there anything in the logs (Help > Reveal Log in Explorer) that might provide a clue? Have you tried uninstalling and reinstalling IDEA? I do not like such solutions as a first approach. But given how oddly IDEA is acting, I wonder if something got corrupted in the installation. Given that it should only take a few minutes to do a reinstall, I think it would be worth the effort. When you run the install, run it as administrator. (Right click the installer and select run as administrator.)

Please sign in to leave a comment.