How to run java11 and jfx11 application on jre1.8 - java

I am a computer student and I had during my internship in a company, develop a small java software using JavaFX, maven, and apache.poi.
Info: The application works on Intellij and builds perfectly, my problem concerns the *.jar that I generate once the project is finished.
I first used JDK 14 and JFX14, however at the time of the execution (java –jar xx.jar) I had an error saying that I was compiling the program in JAVA 58 (JAVA 14) and that I was using JRE 52 (JAVA 8).
So I modified the project to compile with JDK 11 and JFX 11, and I now have the same error telling me that I am compiling the program in JAVA 55 (JAVA 11) and that I was using JRE 52 (JAVA 8).
The error comes from the fact that my PC uses jre1.8.0_251 by default.
So I tried to launch the program in this way "path_to_jdk11 \ bin \ java.exe" -jar xxx.jar and it works.
So that's my problem:
The majority of users use the version of JAVA offered on the Oracle site, i.e. jre1.8.0_251 which is the latest version available. Outside my program requires Java 11, which is not deploying on corporate PCs, I imagine.
I tried to port my project to java 8 but I have errors with Maven and the module.info.java.
Do you have a tip for deploying the *.jar or deploying it in .exe so that it can run with a user who has jre1.8.0_251?
Respectfully

Don't try to build a fat jar. It won't work with modern Java. Instead build a real installer. This can be done easily with JDK 14+. Just follow this tutorial https://github.com/dlemmermann/JPackageScriptFX which covers everything you need. This uses jpackage from JDK 14 and some other tools from it and also works with non-modularized projects. When you install JDK 14 just make sure you set JAVA_HOME and your PATH correctly so that all the tools find the correct version of Java for building.

Related

Is apache netbeans 11.3 compatible jdk 13 does jdk 13 include derby database?

I had installed Apache NetBeans 11.2 whereas my JDK was 13. I was facing lots of issues such as in my java ant web project if I run a simple java code to print hello it would show virtual machine not found error whereas the same program would run without any issue in a normal java ant project. So I was wondering is this some compatibility issue?
Also, I find derby useful for my small project but it was not included in jdk13 as in its previous versions.
JavaDB was removed in Java 8 update 181. JavaDB is no longer shipped with Java Runtime Environment.

How can I install Netbeans with JDK 10

I try the command line with JavaHome:
netbeans-trunk-nightly-201803230002-javase-windows.exe --javahome "C:\Program Files\Java\jdk-10"
It should work, but I receive a message:
There is no JRE at the specified location C:\Program Files\Java\jdk-10
Thanks!
Updated on July 31, 2018 to strikethrough obsolete information, and add details on the official release of NetBeans 9.
You are downloading NetBeans from Oracle's site, so you should have no expectation that even the nightly dev build will work with Java 10.
NetBeans is currently being handed over to Apache from Oracle, and there is a development build available for download from Apache in the form of a zip file from here:
https://builds.apache.org/job/incubator-netbeans-linux/
You can unzip that file on Linux, Mac or Windows and it will work with Java 10. Just be aware that it has not yet been formally released; that is a few weeks away.
You can check for bugs and/or report bugs here:
https://issues.apache.org/jira/projects/NETBEANS
UPDATE June 4, 2018
Apache NetBeans 9.0 RC1 was released on May 28. The source and the binary can be downloaded as zip files from here:
https://netbeans.apache.org/download/nb90/nb90-rc1.html
UPDATE July 31, 2018
Apache NetBeans 9.0 was released on July 29. The source and the binary can be downloaded as zip files from here:
https://netbeans.apache.org/download/nb90/nb90.html#_downloading
!!! IMPORTANT NOTE !!!
NetBeans 9 officially only supports Java SE which means:
The Project Wizard is limited compared to NetBeans 8.2. For example, it does not even allow you to create a Java web application.
Most plugins are not available. The unzipped download of NetBeans does not even allow you to install plugins for Java EE, C/C++, Fortran, Grails, Groovy, PHP etc.
However, it is a simple process to enable that functionality (at your own risk). See the answer to How to get Netbeans 9 to deploy a valid webapp on Tomcat for details.
For an explanation on why the plugins are not available by default see What's Happened to My Favorite NetBeans Plugins?.
For Windows you can install with NetBeans Extracted bundle :
Open cmd as Admin User
netbeans-XXX-windows.exe --extract
then run
java -jar bundle.jar
Netbeans won't work properly with jdk version 10. Install jdk 8u/17l and everything should go well.

JavaFX and IntelliJ 14 Alternative Self Packaging to EXE

I am using Ubuntu 14.04 and I am trying to self package a JavaFX app in IntelliJ 14. This has been wasting my time for past 2 days. It took me less to develop the app. Any help will be greatly appreciated.
What I want is a self-contained package that will run on any platform (mainly Windows). Now I am using Ubuntu and I want this:
1 - Using my current OS (Ubuntu 14.04) I want to create an exe file that will act as an installer or simple executable for windows whatever it is
produced.
I tried this, http://launch4j.sourceforge.net/docs.html and Excelsior JET, the first one does not create a self-contained app, and the second one did not run.
2 - I tried this http://docs.oracle.com/javafx/2/deployment/self-contained-packaging.htm
I tried using the javafxpackager which in Java8 it has been renamed into javapackager, and I ran this:
javapackager -deploy -native exe -srcfiles src/ -outdir out/artifacts -outfile GreekTest -appclass foo.Main
What it did was to just generate a bunch of java files in the ourdir. No exe.
From the link I posted above,
First of all I have no such XML file as in my JavaFX app directory that has a task <fx:deploy> is this generated by the user?
3 - IntelliJ Build Artifacts Tools just generate a jar file, no-self contained app.
4 - I also want to avoid Maven/Ant as I don't know how to use it.
Any help?
Check out Capsule.
Re Excelsior JET not working, you must be on a 64-bit Ubuntu system, and it needs some 32-bit libraries. Here is an excerpt from the installation instructions:
Important notice for 64-bit Linux users:
As of version 10.5, some key components of the 64‑bit version of
Excelsior JET for Linux remain 32‑bit. Most 64‑bit Linux systems do
not have the 32‑bit libraries installed by default. If you receive a
"No such file or directory" or "cannot execute binary file" message on
an attempt to run any Excelsior JET component, or one of its graphical
tools fails on startup with
Exception in thread "main" java.lang.NoClassDefFoundError: java.awt.Frame
you need to install those libraries.
On Ubuntu/Debian, the procedure used to be as simple as:
sudo apt-get install ia32-libs
but in the latest versions you have to list the libraries explicitly:
sudo apt-get install libc6:i386 libx11-6:i386 libxext6:i386 libxrender1:i386 libxi6:i386 libxtst6:i386
The list of libraries and installation procedure in other distros may
differ.
(Full 64‑bit port is our top priority, but doing it right takes time.
Please bear with us.)
In any case, it won't help you create "a self-contained package that will run on any platform (mainly Windows)." First, it creates a native executable that will run on either Windows, OS X, or Linux, but not on two or three of these. Second, it does not support cross-compilation as of version 10.5, so you need Excelsior JET for Windows to create a Windows EXE.

Unable to run JAVAC in Windows 7

Probable JAVA Version 7 Update 67 Installation Problem - javac.exe not found
I think that there is no problem in giving contact numbers and this is not a same query as it is on Windows 7.
After installing I tried to check javac.exe in this dir C:\Java\jdk67\bin and it was not present there. Then I searched C:\ and could not find there.
I installed JDK from the site:
https://java.com/en/download/index.jsp
I think that the installer has some problem.
Regards
Rohan Sarker
www.rohansarker.com
+913324288069 / +917278539338
Rohan, You can download Java for software development or running applications.
For java software development You need to download the Java JDK (which contains the java compiler javac.exe) at: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
For Java application execution You need to download the Java JRE (which contains the java interpreter) at: http://java.com/download/index.jsp
Best regards.

Ubuntu 11.04: Running MARS simulator

I am trying to run the MARS simulator in order to do some Assembly homework in Ubutnu 11.04. MARS(jar file) requires Java to be installed and so I did install Java.
After that I typed
java -jar .jar
and as a result I got:
Failed to load Main-Class manifest attribute from .jar
What must I do in order to run this file properly?
There are different Java implementations and you are not using the "official" one. (As is clear from the libgcj.so that appears on your error) and that one tends to be the most reliable.
Ubuntu 11.04 might still have the java-6-sun package (it was deprecated on newer Ubuntu releases because of license conflicts), so you should try with that one.
If that java is not in Ubuntu, then you can try downloading and installing Java from the Oracle site.

Categories

Resources