No JRE included in app when using fx:deploy through Ant - java

I'm trying to use javafxpackager and Ant to create a self-contained application (preferrably as an msi, but same results with exe).
If I run the javafxpackager from the command-line, it works perfectly.
If I run it through Ant (using fx:deploy), it still runs to completion, but when I install the application, it does NOT include the 'jre' directory.
When I install, then run, I get the following message:
Error loading jvm.dll
How do I get Ant, using fx:deploy, to include the JRE directory in my application package?

Related

how to run/execute a java code(maven project) outside the IDE

I am new to programming, there is a maven project with java code that does certain testing and it runs regularly through Jenkins pipeline, it runs the tests on an environment (linux machine).
Now what I am struggling and not knowing where to start is how can I test this code manually knowing that it has different Mains (i.e Main1 , Main2 , Main3) and I want to run a certain Main not all, for example only Main1 which tests specific thing.
ps: I have the code in Intellij, but I want to run it outside intellij, I want to run it on the environment I'm testing (linux maachine).
first you have to build the maven project using this command in your project directory:
mvn package
After a successful build, you will see a .jar file has created in target folder same as your package name and version.
finally you have to RUN the project.
To run the project use this command:
java -cp target/jarfileName.jar path_of_the_project_startup
Done.
First, you need to build your maven project. Navigate to the project folder (you must have the project root pom.xml there) open a terminal and to build it type:
mvn clean package
Depending on your project structure, a successful run of this command will result in several target folders at different levels for your modules and possibly .jar files inside them. Navigate into the target folder of the module in which your entry point (main) is and check jar file name. Let's call it jarname.jar for simplicity.
In case you have several entry points in the same jarname.jar, you can run them like this:
java -cp jarname.jar Main1
java -cp jarname.jar Main2
java -cp jarname.jar Main3
If you want to run from terminal and still debug from IntelliJ, run app with:
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
and then create a 'Remote JVM Debug' config in IntelliJ on same port (5005), adding some break points and 'Debug'.
As an alternative, you can create Run Config 'Java Scratch' from IntelliJ to run/debug your app.

How to export JavaFX gradle project as a standalone executable file for deployment?

I have completed my JavaFX application within gradle build system, and it is working fine in all way. Now I want to export as a .EXE file for standalone software distribution, I tried much more tricks but no gain. If some one can help me out to wrap my project in a software setup, It would be grateful.
Follow these steps to export your JavaFX project into executable Jar
Goto> Project Structure
Goto>>Artifacts
Click "+">> To add new artifact
It will shows a dropdownlist
Select>>Jar>>From module with dependencies
You will see a nested window as shown
Select Main class of your project
Check In the Option " Copy to output directory.." >>Ok
Goto>> Menu-bar>>Build>>Build Artifacts
Select>> your Project.jar>> Build
This will create executable jar file in your project source folder
Locate your jar file in path project\out\artifacts..
Now you can run this jar file simple cmd commad or with batch file
Cmd Command>> Java -jar project.jar
Using batch file>> make .bat file name it "RUN" and write these commands inside
Specify the Java Runtime path and "Javafx Sdk path" along with VM
options & Project Jar
Run your standalone application .. Enjoy ;)
Creating an installer for the desktop platforms (Windows, macOS, Linux) has become easy these days. The tool of choice is jpackage which started to be shipped with JDK 14. It can either be used on the command line on the finished project or you can use a Gradle plugin (https://github.com/beryx/badass-jlink-plugin). If your project is not modularized you could follow this tutorial https://github.com/dlemmermann/JPackageScriptFX which also uses jpackage but together with Maven and some other tools from the JDK. The Maven part could easily be rewritten to Gradle, if needed.

How can I export application with JavaFX so users without it can run the app

I have created simple app using Eclipse (JavaSE-1.8). I work on Windows and I have installed e(fx)clipse on my computer so I can easily use JavaFX and run the app. The problem is when I export the app to JAR file and run it on linux. I have to use --module-path and --add-modules to make it work with JavaFX. How can I export my App so users without JavaFX installed can run it without any problem?
I have tried:
- exporting Runnable JAR with option "Package required libraries into generated JAR"
- exporting by Maven with plugin mvn jfx:jar

Eclipse headless build of C++ & Java Projects

I am performing checkout from SVN which contains both Java & C++ projects. After that I am trying to do headless build using following command:
D:\Path\to\eclipse>eclipsec.exe -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -data "D:\path\to\checkout" -build all
After running this what I am getting is only :
Building All Projects...
Building workspace
That's it..Its just creating a .metadata folder in the given path D:\path\to\checkout and nothing else. What is expected is it should create .dll files of C++ projects, but it does nothing.
How can I achieve proper headless build & how to manage dependencies?
UPDATE
So I imported that folder into eclipse(& closed it so that I run it from command line) and ran above command, what it is doing now is building projects but gives error whenever processing a C++ file:
fatal error C1083: Cannot open include file: 'Exceptions/Exception.h': No such file or directory
Any suggestions??

How to make a jar file as executable binary for linux and run as service

I have a java jar file developed under Netbeans which I need to deploy in Linux. Now as per my requirement I have to make it as binary executable just like we get linux binaries to install and zip it under .tar extension so that user can install it from terminal.
Also I need to make it as linux daemon so that the application gets start as soon as the machine is turned on.
I am using Netbeans as development IDE and I need to install it under Linux Ubuntu machine.
An approach:
Create an executable JAR in Maven. Another option I prefer is to use Maven AppAssembler plugin. This is way more configurable and would give a quicker build, but will result into several JARs.
Create an upstart script: chase-seibert.github.io/blog/2011/11/18/running-a-jar-as-a-service-linuxupstart.html

Categories

Resources