代号Arch Linux上的一个媒体文件I/O异常 [英] Codename One media file I/O exception on Arch Linux
问题描述
我正在开发一个Android应用程序,该应用程序几乎已经在Ubuntu上完成了,并且将在Arch Linux上获得最终的认可.
I am developing an Android application that I have almost finished on Ubuntu and that is gaining the final touch on Arch Linux.
我已经重新安装了Java和Eclipse,并且该项目正在正常运行,除了无法执行媒体文件之外,即使这些类都相同且媒体文件位于同一位置也是如此.
I have reinstalled Java and Eclipse, and the project is running without a problem, except that the media files cannot be executed, even if the classes all the same and the media files in the same location.
代码完全相同,只是平台已更改.我已经尝试过同时使用open-jdk-8和open-jdk-11.
The code is exactly the same, only the platform has changed. I have tried with both open-jdk-8 and open-jdk-11.
这是来自测试项目的代码:
This is the code from a testing project:
Form hi = new Form("Hi World", BoxLayout.y());
Button buttonSound = new Button("Play");
buttonSound.addActionListener(l -> {
InputStream inputStream = Display.getInstance().getResourceAsStream(getClass(), "/children-hooray.wav");
try {
Media media = MediaManager.createMedia(inputStream, "audio/wav");
media.play();
} catch (IOException e) {
e.printStackTrace();
}
});
hi.add(buttonSound);
hi.show();
加载控制台后,输出为:
Upon loading the console output is:
Adding CEF to classpath
Found theme.css file. Watching for changes...
CSS> Retina Scale: 1.0
CSS> Using stateful mode. Use -help flag to see options for new stateless mode.
CSS> Looks like this CSS file needs CEF on classpath... adding it now, and retrying...
CSS> Adding CEF to classpath
Retina Scale: 1.0
CSS> Retina Scale: 1.0
CSS> Using stateful mode. Use -help flag to see options for new stateless mode.
CSS> Updating merge file /home/rainer/eclipse-workspace/A1_Test_En/css/theme.css.merged
CSS> Starting watch thread to watch [/home/rainer/eclipse-workspace/A1_Test_En/css/theme.css]
CSS> Compiling /home/rainer/eclipse-workspace/A1_Test_En/css/theme.css.merged to /home/rainer/eclipse-workspace/A1_Test_En/src/theme.res
CSS> File has not changed since last compile.
CSS> CSS file successfully compiled. /home/rainer/eclipse-workspace/A1_Test_En/src/theme.res
而堆栈跟踪是这样的:
Adding CEF to classpath
Retina Scale: 1.0
java.io.IOException
at com.codename1.impl.javase.JavaSEPort.createMedia(JavaSEPort.java:8506)
at com.codename1.ui.Display.createMedia(Display.java:3597)
at com.codename1.media.MediaManager.createMedia(MediaManager.java:308)
at com.codename1.media.MediaManager.createMedia(MediaManager.java:226)
at com.mycompany.myapp.Main.lambda$1(Main.java:65)
at com.codename1.ui.util.EventDispatcher.fireActionEvent(EventDispatcher.java:349)
at com.codename1.ui.Button.fireActionEvent(Button.java:687)
at com.codename1.ui.Button.released(Button.java:728)
at com.codename1.ui.Button.pointerReleased(Button.java:835)
at com.codename1.ui.LeadUtil.pointerReleased(LeadUtil.java:153)
at com.codename1.ui.Form.pointerReleased(Form.java:3817)
at com.codename1.ui.Component.pointerReleased(Component.java:4710)
at com.codename1.ui.Display.handleEvent(Display.java:2359)
at com.codename1.ui.Display.edtLoopImpl(Display.java:1244)
at com.codename1.ui.Display.mainEDTLoop(Display.java:1162)
at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
推荐答案
在CN1的帮助下,我终于设法安装了ZuluFx并在Arch Linux上运行了媒体文件.如果我的方法可能对其他人有帮助,我会将其发布:
With the aid from CN1, I finally managed to get ZuluFx installed and the media files working on Arch Linux. I post this in case my approach might be helpful to others:
- 下载ZuluFx表单此处更改项目的Java版本:打开Eclipse窗口-首选项->已安装的JRE->添加->标准VM
- Download ZuluFx form here (I have chosen to install Java version 11, but there are many more);
- Extract it into this directory: /usr/lib/jvm/zulu11.45.27-ca-fx-jdk11.0.10-linux_x64;
- Delete/ rename the directory /home/user/.codenameone/cef;
- Change the Java version for the project following the guide here: Open Eclipse Window - Preferences -> Installed JRE -> Add -> Standard VM
这 CN1文章也很有帮助.
This CN1-article is also a helpful read.
这篇关于代号Arch Linux上的一个媒体文件I/O异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!