unable to import javax.sound.midi even after installing jmf

S

SlowLearner

I've installed jmf 2. There's only one copy of the jre on my harddisk
and jmf has added it's jmf.jar etc files into that jre (inside sdk) as
well as placing itself in it's own program files directory;
It's added the correct classpath to the classpath variable to reach
jmf.jar etc but I still cannot import javax.sound.midi. It says
javax.sound doesn't exist. When my ide starts up you can see it
unpacking jmf.jar also when I'm typing the import line autocomplete
suggests sound and also midi, so it's definitely installed but it wont
compile.

Any Suggestions

Martin
 
A

Andrew Thompson

SlowLearner said:
I've installed jmf 2.

2.1.1 e?
...There's only one copy of the jre on my harddisk
and jmf has added it's jmf.jar etc files into that jre (inside sdk)

Let's (try to) get clear - is this a JRE, or an SDK?
What version? ...
...as
well as placing itself in it's own program files directory;
It's added the correct classpath to the classpath variable to reach
jmf.jar etc but I still cannot import javax.sound.midi.

....The reason I ask is that despite the sound
packages coming in the JMF, they were also
included in core Java as of 1.3 (at least, that
is what I understand, and if that is not correct,
I put the wrong thing here
<http://www.javasaver.com/testjs/jmf/#test3>!).

So, it amazes me that you did not have
access to the sound packages even
before installing the JMF.

Unless you are using a 1.2 or 1.1 SDK...
....It says
javax.sound doesn't exist. When my ide

'my ide'.. that is not a brand I am familiar with.
It might pay to be a little more specific about the
IDE and its version..
...starts up you can see it
unpacking jmf.jar

That matches no IDE I know of..

What IDE? What version? Have you
managed to compile any java code in
"my ide" on this PC with the installed
JRE/SDK?
Any Suggestions

Provide more details - as prompted by
questions above, plus whatever else
you can think might be relevant.

(Oh, but I did just remember, sound.jar does
come *separately* to jmf.jar..)

Andrew T.
 
S

SlowLearner

Andrew said:
2.1.1 e?


Let's (try to) get clear - is this a JRE, or an SDK?
What version? ...


...The reason I ask is that despite the sound
packages coming in the JMF, they were also
included in core Java as of 1.3 (at least, that
is what I understand, and if that is not correct,
I put the wrong thing here
<http://www.javasaver.com/testjs/jmf/#test3>!).

So, it amazes me that you did not have
access to the sound packages even
before installing the JMF.

Unless you are using a 1.2 or 1.1 SDK...


'my ide'.. that is not a brand I am familiar with.
It might pay to be a little more specific about the
IDE and its version..


That matches no IDE I know of..

What IDE? What version? Have you
managed to compile any java code in
"my ide" on this PC with the installed
JRE/SDK?


Provide more details - as prompted by
questions above, plus whatever else
you can think might be relevant.

(Oh, but I did just remember, sound.jar does
come *separately* to jmf.jar..)

Andrew T.

jmf version = 2.1.1 e
ide=Java Studio Enterprise 8
jdk = 1.5.0.04
yes I have compiled and run java code in the ide. It still compiles now
if I take out the import statment. I'm new to Java and objects etc, so
I realise I'm probabley doing something really basic wrong, but just
cant figure out what. Thanks for replying so fast. I'll remember to
give more detail from now on.

Does this infomation help at all, any suggestions?

Martin
 
S

SlowLearner

SlowLearner said:
jmf version = 2.1.1 e
ide=Java Studio Enterprise 8
jdk = 1.5.0.04
yes I have compiled and run java code in the ide. It still compiles now
if I take out the import statment. I'm new to Java and objects etc, so
I realise I'm probabley doing something really basic wrong, but just
cant figure out what. Thanks for replying so fast. I'll remember to
give more detail from now on.

Does this infomation help at all, any suggestions?

Martin

Ok I've noticed very few people mention Java Studio Enterprise IDE so
I've reinstalled everything on my laptop starting with a formatted
harddisk. This time I've installed NetBeans5.5 Bundeld with jdk
1.5.0.09
jre 1.5.0_09 has installed itself presumabley with the bundled NetBeans

But I still cannot import javax.sound.midi;

My code is extremley simple


package helloworldapp;
import javax.sound.midi; // package javax.sound does not exist error
here
import java.awt.*;

public class HelloWorldApp {


public HelloWorldApp() {
}

public static void main(String[] args) {
System.out.println("Hello World!");
}

}

Any suggestions now I'm using a well known ide?
 
C

Chris Uppal

SlowLearner said:
I've reinstalled everything on my laptop starting with a formatted
harddisk.

Boy oh boy! If at first you don't succeed, nuke the f***er.

(Please don't take that as criticism -- I'm impressed. And a little amused...)

import javax.sound.midi;

That should be:
import javax.sound.midi.*;

If you leave off the ".*" then Java will take "import javax.sound.midi;" as
importing a single class named "midi" from package "javax.sound". But
javax.sound has no class with that name, hence the (unfortunately misleading)
error message.

-- chris
 
A

Andrew Thompson

Chris Uppal wrote:
....
That should be:
import javax.sound.midi.*;

Drat! Knew I should have demanded code, first up!
( Actually, even then I would not have spotted that -
unless it was compilable code ;)

Andrew T.
 
S

SlowLearner

Chris said:
Boy oh boy! If at first you don't succeed, nuke the f***er.

(Please don't take that as criticism -- I'm impressed. And a little amused...)



That should be:
import javax.sound.midi.*;

If you leave off the ".*" then Java will take "import javax.sound.midi;" as
importing a single class named "midi" from package "javax.sound". But
javax.sound has no class with that name, hence the (unfortunately misleading)
error message.

-- chris

THANKS FOR ALL YOUR HELP EVERYBODY!!
The .* on the end made all the difference
Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,983
Messages
2,570,187
Members
46,747
Latest member
jojoBizaroo

Latest Threads

Top