为了账号安全,请及时绑定邮箱和手机立即绑定

请问JMF老是报找不到设备是怎么回事,我已经安装jmf2.1e

请问JMF老是报找不到设备是怎么回事,我已经安装jmf2.1e

qq_颖_男人_03406653 2016-07-18 07:41:52
还有我用jmf来实现简单的mp3播放也会出现找不到主类的情况代码如下package com.gml.jmf;import javax.media.*;import java.io.File;import java.io.IOException;import java.net.URL;public class SimpleAudioPlayer { private Player audioPlayer = null; public SimpleAudioPlayer(URL url) throws IOException, NoPlayerException, CannotRealizeException { audioPlayer = Manager.createRealizedPlayer(url); } public SimpleAudioPlayer(File file) throws IOException, NoPlayerException, CannotRealizeException { //this(file.toURL());  audioPlayer = Manager.createRealizedPlayer(file.toURL()); } public void play() {  audioPlayer.start();  }  public void stop() {  audioPlayer.stop();  audioPlayer.close();  }  public static void main(String[] args) {   File audioFile = new File("E:/KuGou/Sam Smith-Writing's On The Wall.mp3");   if(!audioFile.exists()){    try {     audioFile.createNewFile();    } catch (IOException e) {     // TODO Auto-generated catch block     e.printStackTrace();    }   }   try {    SimpleAudioPlayer player = new SimpleAudioPlayer(audioFile);    player.play();    //player.stop();   } catch (NoPlayerException e) {    // TODO Auto-generated catch block    System.out.println("没有播放器");    e.printStackTrace();   } catch (CannotRealizeException e) {    // TODO Auto-generated catch block    System.out.println("不能实现这个");    e.printStackTrace();   } catch (IOException e) {    // TODO Auto-generated catch block    e.printStackTrace();   }  }}运行结果为:错误: 找不到或无法加载主类 com.gml.jmf.SimpleAudioPlayer
查看完整描述

2 回答

?
1994我

TA贡献3条经验 获得超1个赞

没看到你player的类,是不是忘记写了?或者名字写错了?


public class SimpleAudioPlayer {
 private Player audioPlayer = null;

查看完整回答
反对 回复 2016-07-20
?
KXFT

TA贡献113条经验 获得超58个赞

看看你的环境变量配置正确了没

查看完整回答
反对 回复 2016-07-18
  • 2 回答
  • 0 关注
  • 1750 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信