Deploying a JavaFX Application with IntelliJ - intellij-idea

Ive gone through tons of documentation and tutorials but nothing seems to work. Heres what i need
I want to package an deploy a desktop JavaFX application as a self contained package for Mac and Windows.
I want the application to have a custom icon (of course)
I want this application to be able to reference a text file that is in a resources folder (that can be modified by the user) to connect to a database.
Here is what i have tried:
Building artifacts in IntelliJ -This creates a jar with related 3rd party jars and a bundle folder with an exe and dmg. The icon is the default java one, and i cant reference by db.config file from the exe or dmg, i can reference it from the jar however
Generating an ANT build file - Once created this file contains errors complaining that various tags are not allowed and that properties are not defined.
Ive tried placing my .ico image which is the same name as my deployed application in every possible folder.
Im in serious need of help.
build.xml : http://tinypic.com/r/2md2zbn/8

Related

HelloWorld in Kotlin gives error "Could not find or load main class"

I spent the last 1,5 hour trying to make this simple tutorial work in IntelliJ IDEA, as you can see in this video.
When trying to run the code, I get the error:
/[...] -Dfile.encoding=UTF-8 src.HelloKt
Error: Could not find or load main class src.HelloKt
Caused by: java.lang.ClassNotFoundException: src.HelloKt
I have tried setting up SDK, invalidating cache, removing .idea and .gradle, rebuilding project, deleting the profile and adding it again. I tried those actions in different orders.
Here's a screenshot of the project:
It also complains Kotlin is not configured, but I have already configured it.
Here's the run configuration:
Here are the project settings:
Your Hello.kt file needs to be somewhere inside the src/main folder, probably in src/main/kotlin. This is different from the tutorial, because your project is using Gradle, and the one in the tutorial isn't. I think this is because newer versions of IntelliJ use Gradle by default for new projects, which wasn't the case when the tutorial was written.
The use of src/main/kotlin and src/test/kotlin as source code directories is a convention in Gradle (and Maven). When importing a Gradle project into IntelliJ, main becomes a module, and kotlin becomes a source folder within that module. The same goes for test. In your screenshots, the bold text and blue icons on main and test confirm that's how your project is set up. Files outside of those folders aren't treated as source files, which explains why your Hello.kt file isn't being compiled or recognised correctly.
It's likely that the default behaviour of IntelliJ when creating a new project has changed since this tutorial was written. In the tutorial, they select "Kotlin" as the project type and this creates a project that doesn't use Gradle. As a result, the project doesn't use the src/main/kotlin directory structure.
I can see from your video that you selected the same option, but on the next screen, IntelliJ still automatically selected Gradle as the build system for the new project. To match the project structure used in the tutorial, I think you would need to select "IntelliJ" as the build system.

MSBuild GenerateResource task produces resource file names with incomplete namespace, causing our app to crash at runtime

We build mobile apps using Xamarin Forms, with macOS building the iOS apps. We ran into an issue today that has left me scratching my head.
A normal build with embedded resource files looks like this:
CoreResGen:
/Library/Frameworks/Mono.framework/Versions/5.16.0/lib/mono/4.5/resgen.exe /useSourcePath
[....all of our references....]
/compile
Resources/HtmlStyleRes.resx,obj/BuildAgentRelease_iOS/ForumApp.Common.Resources.HtmlStyleRes.resources
Resources/TextRes.resx,obj/BuildAgentRelease_iOS/ForumApp.Common.Resources.TextRes.resources
Resources/TextRes.nb.resx,obj/BuildAgentRelease_iOS/ForumApp.Common.Resources.TextRes.nb.resources
So no surprises there; the .resx files are compiled into binary .resources files with the assembly namespace + folder name + resx filename.
However, we made a change to our directory structure on the build server, and this changed the output from CoreResGen:
CoreResGen:
/Library/Frameworks/Mono.framework/Versions/5.16.0/lib/mono/4.5/resgen.exe /useSourcePath
[....all of our references....]
/compile
Resources/HtmlStyleRes.resx,obj/BuildAgentRelease_iOS/ForumApp.Common.HtmlStyleRes.resources
Resources/TextRes.resx,obj/BuildAgentRelease_iOS/ForumApp.Common.TextRes.resources
Resources/TextRes.nb.resx,obj/BuildAgentRelease_iOS/ForumApp.Common.TextRes.nb.resources
Notice how the "Resources" folder was dropped from the .resources filename. When compiled into an app, this causes our app to crash at runtime, since the resource file namespace is now different.
We build our apps using self-hosted Azure agents. All apps are built from the same repository, and as part of an effort to streamline the build servers, we implemented a pipeline task to utilize a common repository folder for all builds. The Azure agent would normally build out of _work/build-id/s, and our pipeline task will symlink this directory to _work/g/repo-id so that multiple builds can share the same repository.
When we build with the repo in _work/build-id/s, everything is fine. When we build with the symlinked repo, the file namespace error occurs.
As far as we can tell, this happens on macOS, but not on Windows.
We have a possibly related issue that happens on macOS, but not on Windows. The following outputs are from macOS using mono:
Path.GetDirectoryName(#"Resources\TextRes.resx") => ""
Path.GetDirectoryName(#"Resources/TextRes.resx") => "Resources"
Path.GetDirectoryName is used in CreateCSharpManifestResourceName to create the output file name from Resources\TextRes.resx, but there appear to be guards replacing \ with / and I can't see why symlinking the source folder would trigger it.
Has anyone experienced this? Am I missing something obvious?

Packaging Unreal Build Configurations

I have integrated the Steam API with my project and I had to add the actual API to the include directories of my DebugGame_Editor Configuration as well as the library directory.
The editor has been building properly for a month and Steam runs in-game, but now I have gotten to packaging my game and I am getting an error:
Cannot open include file: 'steam/steam_api.h': No such file or directory.
I assume that the configuration that it is using to package the game is missing those include directories and the library directory. Which configuration does UE4 use when packaging a game for Win64? There are like 40, and I don't want to try each and every one.
Engine Version: 4.7.6 from source (GitHub)
Edit:
I have gone through all configurations in the configuration manager in Visual Studio and added the two directories to the include and library sections of both Win32 and x64 in all of them (except the ones that say Mac or IOS), but no dice. It still throws that error message when it is trying to build ProjectName.generated.cpp
I'm not sure what to try next.
So I was able to fix this problem by including the files with an absolute path, rather than relying on relative include paths.

Adding Jar files to IntellijIdea classpath

I have created a new Intellij project. But I can't use the third party jars in my project. I have the jars in a directory structure as follows:
repository/commons-logging/commons-logging-1.0.4.jar
repository/commons-lang/commons-lang-2.1.jar
etc.
I want to add them just by pointing to the repository directory, but couldn't find any ways to add them.
But when I am using classes or API from that jars, the editor can't resolve the classes.
I have tried from Project Structure but can't configure it.
Go to File-> Project Structure-> Libraries and click green "+" to add the directory folder that has the JARs to CLASSPATH. Everything in that folder will be added to CLASSPATH.
Update:
It's 2018. It's a better idea to use a dependency manager like Maven and externalize your dependencies. Don't add JAR files to your project in a /lib folder anymore.
If, as I just encountered, you happen to have a jar file listed in the Project Structures->Libraries that is not in your classpath, the correct answer can be found by following the link given by #CrazyCoder above: Look here http://www.jetbrains.com/idea/webhelp/configuring-module-dependencies-and-libraries.html
This says that to add the jar file as a module dependency within the Project Structure dialog:
Open Project Structure
Select Modules, then click on the module for which you want the dependency
Choose the Dependencies tab
Click the '+' at the bottom of the page and choose the appropriate way to connect to the library file. If the jar file is already listed in Libraries, then select 'Library'.
On the Mac version I was getting the error when trying to run JSON-Clojure.json.clj, which is the script to export a database table to JSON. To get it to work I had to download the latest Clojure JAR from http://clojure.org/ and then right-click on PHPStorm app in the Finder and "Show Package Contents". Then go to Contents in there. Then open the lib folder, and see a bunch of .jar files. Copy the clojure-1.8.0.jar file from the unzipped archive I downloaded from clojure.org into the aforementioned lib folder inside the PHPStorm.app/Contents/lib. Restart the app. Now it freaking works.
EDIT: You also have to put the JSR-223 script engine into PHPStorm.app/Contents/lib. It can be built from https://github.com/ato/clojure-jsr223 or downloaded from https://www.dropbox.com/s/jg7s0c41t5ceu7o/clojure-jsr223-1.5.1.jar?dl=0 .

IAR Embedded Workbench and Custom Build

I have a project in IAR Embedded Workbench that works fine. In this project there is a source file (webpages.c) that is automatically created by another tool. This tool creates the file webpages.c starting from the files located in the specified folder webpages (so one file is generated starting from a set of files).
I want to configure the project in IAR in such a way, before the building process, the tool is automatically run if a file in the webpages folder is changed since the last build.
I configured a pre-build step and it really works with a Rebuild All. But if I change just a file in the webpages folder and issue a Make command, IDE thinks the project is up-to-date and doesn't start building.
Any solution?
Can't you add them as files to your project under a separate group ?
Then, right-click the options for the group, select custom build, check "override inherited settings" and fill in the commands for the custom build step.