How do I export a tornadofx application? - javafx

I finished writing a little tornadofx app in IntelliJ CE and now want to export it as a single file which can be downloaded and launched by users. For now it would be sufficient to provide a single jar file. But it would be also great to know on how to export a self contained installer for OSX, Windows and Linux. Unfortunately I don't know how to do any of that. Can you help?

Have a look at the FxLauncher project, which is also from the creator of tornadoFX. FXLauncher allows you to easily distribute your javafx/tornadoFX application. The project provides a maven-plugin which allows you to generate a self containing javafx/tornadoFX application that you then publish to a web-server or common directory (e.g an internal app in your company network). After that you can generate native installers for Linux, OSX and Windows. The installer itself will only install a small app, which will know the location of your web-serve or directory. On startup it will download the latest deployed version of you application and run it.
Additional links:
GitHub-project
Introduction screen cast
Customizing update ui

In case you want a single jar file, you can export it as a regular Java program (not the JavaFX option in IntelliJ). You do this by creating and building an artifact.
Go to the Project Structure window, and from there select Artifacts
Click the "+" icon to create a new artifact, and select JAR > From modules with dependencies...
Select the main class and press OK
And that's it, the artifact has been set up, now, to generate jar file, just go to Build > Build Artifacts menu, and select the newly-made artifact, and the IntelliJ will generate the jar file in the "out" directory.
Not sure if this is the best solution, but it's what I've been using, and it works for me.

Related

Im building .jar of my program in InteliJ, but I added external .jar with JTatto LookAndFeel and the app doesn't work from desktop. How to repair it?

It's simple application. I'm pretty sure it doesn't work now from Desktop, because of external .jar added at the IDE.
Ok, basically just go in project settings, dependencies, add your jar (dont export) and then build normally
I had to create new project to make it work

Deploying pyqt application to Windows using pyqtdeploy

I would like to deploy for the first time my first app made with PyQt5. I found pyqtdeploy (link) to be probably what I need to do this for Windows and other platforms.
Anyway, I am following this tutorial, but, as I am completely new to deploying applications, I am not sure on one thing: do I need to download Qt for the target specific platform I need to deploy my app to? If so, am I supposed to use qmake from that Qt installation against the result of pyqtdeploy? For example: if I want to deploy to Windows, do I have to download Qt from here (and which version???)?
From the same tutorial page, this is not so clear, maybe it's obvious, but as I am a newbie in this, not for me.
No you don't need to download Qt.
When building your 'sysroot.toml' file, pyqtdeploy will download qt-everywhere-src and builds it from source.
In the built sysroot directory you can find qmake executable in "...\Qt\bin" (qmake.exe) depends on where your project files (sysroot.toml file) are.
For example if your host machine is Windows and C:\Users\username\Desktop\My_PyQtDeploy_Proj is your project folder which contains sysroot.toml, after building sysroot you can find qmake in "C:\Users\username\Desktop\My_PyQtDeploy_Proj\sysroot-win-64\Qt\bin\qmake.exe"

android studio adding extern jar library

I would like to add the extern jar library commons-jexl-2.1.1.jar. I copied the jar into the libs/ folder and performed the Add as library... menu point. I don't receive any errors in the code and everything seems to work but when compiling and starting the application I receive the error java.lang.NoClassDefFoundError: org.apache.commons.jexl2.JexlEngineon this line private JexlEngine jexl = new JexlEngine();
Does anyone know what I've missed?
Unfortunately, that menu command is doing the wrong thing for Gradle-based projects, which I assume yours is. (Gradle-based projects are what you get when you create new projects in Android Studio). I've filed bug https://code.google.com/p/android/issues/detail?id=62249 to request implementing this menu command properly for these projects, or at a minimum disabling it until it's implemented to prevent confusion.
In the meantime, you can add external JAR dependencies by going through the Project Structure dialog, which will add the appropriate entries to your build.gradle build file. Choose File menu > Project Structure, and click on the "Modules" entry on the left. Choose your module from the middle list, and click on the Dependencies tab on the right. Then click on the + button at the bottom to add a new dependency. Screen shot here:
The + menu has an option for "File dependency" (pictured). You will get a file chooser that will let you select the jar file.
If your dependency is one that can be found in Maven, you may find it more convenient to specify the Maven coordinates; that way, the build system will automatically download the dependency, and you won't have to download and store the JAR manually. To set that up, choose "Maven dependency" from the + menu. You'll get a dialog where you can search to find the proper Maven coordinates for your library. In your case, those coordinates will be "org.apache.commons:commons-jexl:2.1.1#jar"
If you prefer to edit build files by hand, check out your build.gradle file after completing the Project Structure dialog changes to see what it did.
The docs for using Gradle in Android are at http://tools.android.com/tech-docs/new-build-system
courtesy The App Chaps
I've been struggling with the same thing for many hours, trying to get the Gson jar to work no less. I finally cracked it – here are the steps I took:
Put the Gson jar (in my case, gson-2.2.4.jar) into the libs folder
Right click it and hit 'Add as library'
Ensure that compile files('libs/gson-2.2.4.jar') is in your build.gradle file
Do a clean build (you can probably do this fine in Android Studio, but to make sure I navigated in a terminal to the root folder of my app and typed gradlew clean. I'm on Mac OS X, the command might be different on your system
After I did the above three, it started working fine. I think the 'Add as library' step was the one I'd previously missed, and it didn't work until I cleaned it either.
[Edit - added the build.gradle step which is also necessary as others have pointed out]

Plugin is not recognized in QML Desktop Appication Deployment

I have wrote a Qt Quick Desktop application in c++ qnd Qt Creator(QML) on Windows7. Now I have to deploy it.
I'm using Qt Quick Desktop Components plugin in my application, I've installed it according to these instructions, and I'm using it with:"import Qt.labs.components", as written there.
I tried adding to the .pro file:
QML_IMPORT_PATH = C:\QtSDK\Desktop\Qt\4.7.4\mingw\imports\Qt\labs\components
but I saw it's working well without it, and I removed it.
I've read a guide how to deploy such an application here, and followed it; I have now a deployment folder, with: the .exe file, the needed dll's, and a folder hierarchy like:Qt/labs/components.
in components I put the styleplugin.dll(for desktop components), and a qmldir file, with the content: plugin styleplugin, excactly like in the doc.
but when I'm runnig my application.exe from the deployment folder in another computer, I'm getting a white, empty window, means: It didn't find the .dll file.
Should you explain me please what's wrong?
I know two reasons, when app can not load plugin dll:
Some of dependecies of the plugin dll are missing or can not be found and that is why it can not be loaded. Qt Creator or Visual Studio environment can be different than the system one. For example, your IDE can modify PATH environment variable. Check plugin's dependencies availability with Microsoft Dependency Walker tool in the same environment where you launch your app.
App can not find plugin in standard directories. To check this you should specify plugin import directory explicitly:
QDeclarativeView *rootView = new QDeclarativeView()
rootView->engine()->addImportPath(QLatin1String("path/to/your/imports"));

How to install a Qt application on a customers system?

I've got a Qt app that I need installed on a customers computer, which I can't assume has Qt installed on it. I'm on a Mac OSX and the computer I will be installing it on some Unix based system. I will be installing it myself so I don't need a GUI installation wizard or anything like that. Ideally I'd like to end up with a script or makefile, along with a folder of all the sources and necessary libraries, I just don't know where to start. References would be much appreciated, I haven't found anything useful after many google searches.
My question lies somewhere between these two:
Can you create a setup.exe in qt to install your app on a client computer?
Create Linux install for Qt application?
I don't need a full-blown install wizard (question 1), but I also won't have my machine at the installation site to just keep copying libraries until all dependencies are met (question 2). Basically I need to have everything on a CD ready to install when I get there. Thanks in advance.
There are two ways to install a Qt application on a system:
1 - You can compile Qt statically. This will allow you to deploy you app without any qt dependencies.
2 - You need to deploy your app with Qt librairy files you need (like qtcore.dll on Windows)
You will find all explications for each platform in the Qt documentation : http://qt-project.org/doc/qt-4.8/deployment.html.
To create installer you can use InstallJammer for Windows and Unix.
For MacOSX you need to create a dmg image. This is very simple. Read the following web page for help : http://www.wikihow.com/Make-a-DMG-File-on-a-Mac. By using apple script you can customize dmg (like an Application folder link into the dmg).
My preference for Win32 installer is NSIS.
Hope that helps!
Not sure why you want to avoid the install wizard. It can also help you create Uninstaller, desktop and start menu shortcuts, etc. As mentioned in the posts you refer to, you could use BitRock InstallBuilder (Nokia uses it for Qt Creator)
If you do not want to use a wizard and don't want to compile statically, then you can bundle Qt libraries in the same folder as the app and setup a shell script that sets the LD_LIBRARY_PATH to that directory

Resources