IntelliJ - Access is denied when building Artifacts

Andres picture Andres · Sep 17, 2014 · Viewed 7.7k times · Source

I'm trying to export my JavaFX 2 application using IntelliJ 13.1.2 on Windows 8 x64. This is my setup:

enter image description here

But when I build the artifact I get an error, this is the log:

Information:Compilation completed with 1 error and 0 warnings in 7 sec

Information:1 error

Information:0 warnings

Error:Java FX Packager: D:\Dropbox\Development\MultiWork-PC\out\artifacts\MultiWork_PC (Access is denied)

I don't know if it is a bug or more probably some problem with Windows permission. All the files are copied in the Artifact output folder:

enter image description here

Except the app itself! What I have tried:

  1. Running IntelliJ as Administrator
  2. Changing folder permission so everyone can write/modify it
  3. Changing folder location from D:\, to C:\, Desktop and Documents but still getting the error

NOTE: this doesn't happen if I deploy a jar instead of a JavaFX Application

Answer

Andres picture Andres · Oct 8, 2014

I ended up using Maven to export my JavaFX app:

    <plugin>
        <groupId>com.zenjava</groupId>
        <artifactId>javafx-maven-plugin</artifactId>
        <version>8.1.1</version>
        <configuration>
            <mainClass>foo.bar.mainclass</mainClass>
        </configuration>
    </plugin>

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.5.1</version>
        <configuration>
            <source>1.8</source>
            <target>1.8</target>
        </configuration>
    </plugin>

</plugins>

To clean and build run:

clean jfx:jar

In your /target/jfx/app you will find your executable JavaFX jar file with a lib folder containing all the dependencies.