Configure Java VM of Eclipse to run with JavaFX - java

I would like to know if it is possible to configure the Java VM used by Eclipse to run in this way, that it uses JavaFX SDK libraries.
Please be aware! I don't want to build JavaFX applications on my own in Eclipse, e.g. by using E(fx)clipse or other plugins.
Another remark: I don't use Java development perspective in Eclipse or a Java project. So it won't work to add the external .jars of JavaFX as user libraries!
In my use case I have an third-party GUI application based on JavaFX that has to be started out of Eclipse.
If I try to start this application I receive the following error:
The system reqirements are not met.
Could not find: javafx.properties
in:
/Applications/Eclipse.app/Contents/Eclipse/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.macosx.x86_64_17.0.2.v20220201-1208/jre/lib
Your Java Virtual Machine seems not to support JavaFX,
required to run the XXX.
Please make sure you provide a valid path to the Java FX
modules during gui installation.
As you can see by the error message my Eclipse runs on a MacOS x64 system.
But I think the way to configure the VM of Eclipse should work on each system the same way.
Thank you.
Steve

If you have a third-party GUI application, then you do not need an IDE like Eclipse.
Ideally the publisher of your app would have provided the app as a package that includes the JavaFX/OpenJFX libraries as well as all the parts of a JDK/JVM needed to run that app on your Mac.
If the publisher gave you only the bare-bones app without the needed libraries & JDK/JVM, you can obtain a JDK/JVM bundled with those libraries.
At least two vendors supply a JDK with JavaFX/OpenJFX libraries:
ZuluFX by Azul Systems
LibericaFX by BellSoft
Both are available free-of-cost with optional support plans available for sale. Download either product as an installer specific to your Mac, while paying attention to either Intel-based Mac or Apple Silicon (ARM, AArch64) based Mac.
You can verify the install by using a console such as Terminal.app to run:
java --version
… and:
which java
You can also use the Finder to locate your installed JVMs by choosing Go > Go to Folder… where you paste:
/Library/Java/JavaVirtualMachines
If your app contains the necessary MANIFEST.MF file, you may be able to launch your app by double-clicking. If not, use a console such as Terminal.app with the java command to launch the app.

Related

Java Tool Notarize process

we have developed GUI tool using Java SE 11 , packaged using Maven. Recommend user to download and set Java in system path to launch the tool. Batch file for windows and .command file for Mac and Linux. Do we need to get notarize approval from apple to use it in Mac OS. Please advice
Thanks
You don't need Notarization for the script files. For your GUI Tool it highly depends on your projects dependencies. If your project only use common java packages, then everything should be fine. But there are libaries which require notarization. I personally had this issue with the net.java.dev.jna dependency. My experience is based on a jar bundled within an application. I am not sure if it is the same for a jar excuted from a script only. I recommend to just build your app and try to run it on a catalina machine.

Opening a Java Text Adventure outside a JRE

I am rather new to programming and have begun designing a text-adventure game in Java. I am currently having difficulty finding out how to make the text-adventure playable on machines that don't have a JRE such as BlueJ or Eclipse installed. I would like to share my game with friends but don't want to install the JDK and a JRE for them to play it.
Thanks for the help in advance.
1) Using Java Web Start
Java Web Start software provides the power to launch full-featured applications with a single click. Users can download and launch applications, such as a complete spreadsheet program or an Internet chat client, without going through lengthy installation procedures.
2) The Java Packager Tool (For Java 9)
The Java Packager tool can be used to compile, package, sign, and deploy Java and JavaFX applications from the command line. It can be used as an alternative to an Ant task or building the applications in an IDE
3) Wrapping Java to EXE
Multi-platform tools can generate native installers for multiple platforms —
Windows, OS X, Linux
Advanced Installer for Java
install4j
InstallAnywhere
JWrapper
IzPack
InstallShield
Terminology
JDK
This is the Java SE Development Kit, which contains all of the JRE and also tools for building java programs.
JRE
This is the Java Runtime Environment, which only had the bits needed to run java programs
IDE
This is the Integrated Development Environment, which only the developer needs, such as Eclipse, BlueJ or IDEA.
What do users need
To run a JAR or class file the user needs:
Any dependencies that the program needs
Either a JDK or a JRE
Using JLink
You can use JLink to make a small version of the JRE, with only the packages which your program needs to run, reducing the install size, this can then be packaged with your game.
Advantages
Smaller than a full JRE
Faster to load
Disadvantages
If lots of apps have their own JRE then space may be wasted
You will need to update the JREs individually if an update happens

want to make setup files of my java mysql project

I have done a restaurant management project with java fxml and MySQL using intellij idea. Now i want to make a setup file like other software available. I want to make sure that one can easily install the setup file in his computer without installing JDK or other things. And how can i consider my software licence issue? I already tried some jar to exe converter software but failed to do it. Need some help.
Write a custom installer (with native operating system language)
If you are targeting multiple OSs, make for each one "install program" written in its native format. This idea is used by many Java projects, including Netbeans IDE which contains a small C++ runner for windows, linux and other systems. The Netbeans launcher verifies JDK exists and starts up VM with desired arguments. Here you can take a look at it http://hg.netbeans.org/main/file/96711149dcd2/ide/launcher
For example, you write a custom .NET installer for windows that checks if JDK is installed or not, after that it installs your system. The same thing would be for Linux or any other OS.

How to install JRE while deploying a Java Swing application?

I'm new to Java Swing & I'm a bit stumped. The application I'm developing will be installed on systems that have not installed JRE. Is there any way to pack JRE inside the Java Swing application and create an EXE file which installs JRE and the application?
Use deployJava.js to ensure a suitable minimum JRE is installed on the computer of the end user. Then use Java Web Start to install and launch the application itself.
Both of those are:
Supplied by Oracle for deployment of rich client apps.
Designed to work on Windows, OS X & *nix.
You can create .exe files from your Java program source using Launch4J. This tool offers an option to set up a relative path to a Java JDK/JRE. This means you could deliver your software with the needed JDK/JRE.
But be carefull. I think you get in trouble if you offer a JDK/JRE for download due to licensing issues.
Best way is to tell the users to install JDK/JRE themselves....
You have to use an installer for that. Try NSIS for instance

How can I create a Windows .exe (standalone executable) using Java/Eclipse?

I'm new to the programming scene. Been working with C++ for about 5 months now, and have decided I want to start getting into Java. I'm using Eclipse as my IDE, and obviously Java for the language. I'm trying to write a simple HelloWorld application, which can be run through a command prompt executable.
In Visual Studio, it seems it's rather easy to create an executable. All I've ever had to do is use a pull down arrow and choose Release, and then run my build. The purpose of wanting to be able to write/run Java in command prompt is so that I'm able to practice some of the language basics before I go in full force with Swing.
So bottom line, what is the easiest way to create a command prompt .exe written with Java?
Thanks in advance!
Java doesn't natively allow building of an exe, that would defeat its purpose of being cross-platform.
AFAIK, these are your options:
Make a runnable JAR. If the system supports it and is configured appropriately, in a GUI, double clicking the JAR will launch the app. Another option would be to write a launcher shell script/batch file which will start your JAR with the appropriate parameters
There also executable wrappers - see How can I convert my Java program to an .exe file?
See also:
Convert Java to EXE: Why, When, When Not and How
Creating a native installer using jpackage
A java packaging tool named jpackage was released as part of the Java Development Kit (JDK) version 16.
This tool works in conjunction with native packaging tools for various platforms (e.g. WIX for Windows, RPM, and DEB for Linux distributions, DMG for Mac) to allow building native installers for Java applications which can then be run as executables. For distribution, it may be possible to distribute just the executable for the application, independent of the installer (I don't know, I didn't try that).
A nice, tutorial style, blog post that describes the use of the jpackage tool to create a native Windows installer for a Java application is:
How to create a Windows Native Java application (generating .exe file)?
Customizing the runtime image using jlink and jdeps
The packaging tool can (optionally) be combined with the jlink tool:
jlink - assemble and optimize a set of modules and their dependencies into a custom runtime image
This allows you to customize the runtime image for your application to only include the required custom selected modular parts of your application code, java runtime, and 3rd party libraries, rather than distributing a complete java runtime.
Optionally, you can also use the jdeps tool to determine inputs to jlink.
Complete discussion of usage of jdeps + jlink + jpackage + a native bundle creator (e.g. wix/rpm/deb/dmg) is outside of scope for a StackOverflow answer, but various resources can be found on the web if you search.
Creating a standalone .exe instead of an installer
This can be done using warp-packer to create a exe out of the image and app launcher created by jlink.
How to create a standalone .exe in Java (that runs without an installer and a JRE)
Third party tools can help deliver a solution
If you wish to use all these tools in combination, things can get complicated, and I'd advise using a 3rd party utility or template to help perform this task. For example:
badass-jlink-plugin (documentation) -> "allows you to create custom runtime images for modular applications with minimal effort. It also lets you create an application installer with the jpackage tool."
For JavaFX specific applications (as your question has a JavaFX tag), you could review:
JPackageScriptFX -> "demonstrates how projects can use scripts to build self-contained, platform-specific executables and installers of their JavaFX applications via the jdeps, jlink, and jpackage tools."
For native mobile deployments, see Gluon Mobile
This question was Windows specific, but for completeness, if your target is native application deployment on a mobile device, then likely you will need to use a 3rd party solution such as Gluon Mobile.
Background Rationale (ignore if not needed)
creating a native installer using jpackage might be a bit of work, so why would you do it?
Here are some reasons:
When an application is distributed via an installer created using jpackage, that application can be installed on a target system without requiring the user to manually install other dependencies (such as a Java Runtime). The installer will take care of ensuring that your application and any dependencies it requires are installed.
The application ships with its own customized version of the Java Runtime. This means that if the user doesn't install a JRE, and, if they have installed a version of the JRE which is incompatible with your application, your application will still function correctly.
The application can be installed and uninstalled using standard OS facilities for the target platform. Most users of those platforms are familiar with these.
Yes, Java is cross-platform for the most part, but many users don't care much about that, instead they just want a smooth and familiar installation (and uninstallation) experience for their application and jpackage can help accomplish that.
Typical Java programs compile into .jar files, which can be executed like .exe files provided the target machine has Java installed and that Java is in its PATH. From Eclipse you use the Export menu item from the File menu.
Creating .exe distributions isn't typical for Java. While such wrappers do exist, the normal mode of operation is to create a .jar file.
To create a .jar file from a Java project in Eclipse, use file->export->java->Jar file. This will create an archive with all your classes.
On the command prompt, use invocation like the following:
java -cp myapp.jar foo.bar.MyMainClass

Categories

Resources