Search code examples
javamavenaudiojavafxmp3

JavaFX in Codenvy using Maven, is it possible?


I've spent the entirety of yesterday and the start of today trying to find out why Codenvy is using Java 8, but cannot find the JavaFX library that is included with it. I've looked through the files of the machine and cannot find it anywhere. I've also attempted to add it natively as a Source jar, but Codenvy seems to have removed support for this. On top of this, their tutorial page for adding source jars has been replaced with how to set up Che. I just use the Codenvy website and keep everything on the cloud.

So my problem is that I cannot get sound (MP3) to play. I tried the project on a workspace I set up in Codenvy previously, and it worked without an issue... yet a workspace made post Codenvy Beta release doesn't work, the JavaFX library just isn't there. The workspace from the older Codenvy doesn't have a stack (see below). Where as the newer projects do. I've tried workspaces with all the stacks that include Java, and still nothing. I did put the project into the old workspace and it worked flawlessly, but the old workspace doesn't have all the features of the newer ones, like ctrl+space for auto-complete, ect. I may aswell be using Notepad.

Is anyone else experiencing this, and is there a way to fix it?

Below is also my pom.xml so you can see the configuration.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>TMMOJ</groupId>
  <artifactId>TMMOJ</artifactId>
  <version>1.0</version>
  <packaging>jar</packaging>
  <build>
    <plugins>
      <plugin>
        <!-- Build an executable JAR -->
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>3.0.2</version>
        <configuration>
          <argLine>-Xmx1024m</argLine>
          <archive>
            <manifest>
              <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
          <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
          <addClasspath>true</addClasspath>
          <classpathPrefix>lib/</classpathPrefix>
          <mainClass>Main</mainClass>
        </manifest>
      </archive>
    </configuration>
  </plugin>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.7.0</version>
    <configuration>
      <verbose>true</verbose>
      <fork>true</fork>
      <compilerVersion>1.5</compilerVersion>
    </configuration>
  </plugin>
</plugins>

enter image description here


Solution

  • Managed to get this working by adding the jfxrt.jar from the JDK .tar.gz from the official java website to a lib folder, and adding it as a dependency (as described in one of the answers to this question JavaFX 2 as a Maven dependency). This solved the problem.