Skip to main content

JAR signing

1 reply [Last post]
veles831
Offline
Joined: 2010-10-13
Points: 0

Hi,

I try to use this code:

public class XletviewJMFExample
extends HContainer
implements Xlet, ControllerListener
{

private HScene scene;
private XletContext context;
private Player player;

public void initXlet(XletContext ctx) throws XletStateChangeException
{
this.context = ctx;
HSceneFactory factory = HSceneFactory.getInstance();
HSceneTemplate hst = new HSceneTemplate();
hst.setPreference(HSceneTemplate.SCENE_SCREEN_DIMENSION,
new org.havi.ui.HScreenDimension(1, 1),
HSceneTemplate.REQUIRED);
hst.setPreference(HSceneTemplate.SCENE_SCREEN_LOCATION,
new org.havi.ui.HScreenPoint(0, 0),
HSceneTemplate.REQUIRED);
scene = factory.getBestScene(hst);
if (scene == null) {
throw new XletStateChangeException("Can't create HScene");
}
Rectangle rect = scene.getBounds();
setBounds(rect);

scene.setVisible(false);
scene.add(this);
}

public void startXlet()
{
scene.setVisible(true);
try {
String bdUrl = (new BDLocator(null, -1, 0, -1, -1, null)).toExternalForm();
MediaLocator medialocator = new MediaLocator(bdUrl);
player = Manager.createPlayer(medialocator);

player.addControllerListener(this);
player.setMediaTime(new Time(0));
player.prefetch();
player.setRate(1f);
player.start();
if (context != null) {
}
System.out.println("sleeping...");
Thread.sleep(10000);

System.out.println("stopping video 1");
player.stop();

Thread.sleep(5000);
System.out.println("deallocating video 1");
player.deallocate();

Thread.sleep(5000);
System.out.println("closing video 1");
player.close();

Thread.sleep(5000);
System.out.println("starting video 2");
player.addControllerListener(this);
player.start();

System.out.println("started video 2");
Thread.sleep(10000);

} catch (NoPlayerException e) {
e.printStackTrace();
} catch (org.davic.net.InvalidLocatorException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}

public void pauseXlet()
{
player.stop();
player.close();
player = null;
}

public void destroyXlet(boolean unconditional)
{
player.stop();
player.close();
player = null;
if (scene != null) {
scene.setVisible(false);
scene.remove(this);
HSceneFactory.getInstance().dispose(scene);
}
scene = null;
}

public void controllerUpdate(ControllerEvent event)
{
System.out.println("! " + event + " !");
if (event instanceof RealizeCompleteEvent) {
Component comp;
if ((comp = player.getVisualComponent()) != null) {
add(comp);
System.out.println("Added " + comp + " as a video component");
comp.setSize(720, 576);
setSize(720, 576);
validate();
repaint();
}
} else if (event instanceof EndOfMediaEvent) {
player.setMediaTime(new Time(0));
player.start();
}
}
}

I heard that this one works fine but my player dosn't play it.
By the way I didn't sign it after compilation. So, should I sign my JAR's anyway or it not necessary?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
gyanendra135
Offline
Joined: 2008-05-30
Points: 0

You need to sign the JAR's if application is trying to read out side the JAR or trying to read/write something into the BUDA otherwise signing of JAR's is not necessary.