views:

462

answers:

1

So, I'm trying to get a video to play from an HTTP url. To do this, I'm using a URL object, and then openStream on it, like so:

    URL url = new URL("http://good-3gp-videos.com/viapic/e39903da6e5c1e1c5d572a49a88a99e6.3gp");
     player = Manager.createPlayer(url.openStream(), null);

However, there is a problem. When I try to import java.net.URL, eclipse claims that it has no idea what it is. Even when I do:

import java.net.*;

I still get the error.

If I try to run it anyways, it refuses to build, and so my changes aren't being used.

Does the Blackberry JDE just refuse to use certain native Java classes, or am I doing something horribly wrong? I know that java.net exists for my version of Java!

My import statements are as follows:

import javax.microedition.media.Player;
import javax.microedition.media.Manager;
import javax.microedition.media.control.VideoControl;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.system.Characters;
import java.net.*;

I thought that maybe the net.rim stuff meant I could leave off the java. part, and so I tried:

import net.URL;

And still got the same result. Does the Blackberry simulator have it's own net package? That would be very annoying.

+2  A: 

That's a restriction that the Blackberry API got from the J2ME API (which hasn't got a java.net package either).

Check the Blackberry API 4.5.0 to find out how to connect to http-URLs, specifically look at the java.microedition.io package.

Joachim Sauer