Eclipse RCP product export using a certain JDK - java

My Eclipse Mars 4.5.1. uses JDK 8 to start-up (specified in the eclipse.ini)
My RCP project uses JDK 7. The entire workspace uses 7. I've also included the JavaFX JAR until I migrate the whole project to JDK 8, where I won't need it.
When I try to export the RCP project using the .product file, the exported version has some logs saying that certain classes using JavaFX have compile errors. Even though the exported version is started with JDK 7 (specified in the .ini file), and the JavaFX JAR surely was exported too, these UI components crash.
This whole process works with Eclipse starting with JDK 7 !
I really want to use my Eclipse with JDK 8, but ONLY the Eclipse
How does Eclipse influence the export process? My target platform points to eclipse, but has JDK 7 set on it.

You can try to put a JRE 7 in your product location and test if it runs, remove the entry in the .ini file.
plugins
configurations
jre
...
If this works, your entry in the .ini file is probably wrong.
Another thought: "I've also included the JavaFX JAR", where did you include it? Maybe you need to include it in the JRE.

Related

.exe file only runs using Java Dev Kit, instead of Java Runtime Environment

So I've recently made a small app for a high school class, and I want it to be able to run on any Windows computer with JRE installed and updated.
I've made the app in Eclipse, exported it as a runnable JAR file (making sure to have "Package required libraries into generated JAR" selected under Library handling), and then converted that to an executable file using Launch4J. When I first made the exe, under the JRE specification, I had the min JRE version set to 1.8.0 and I originally had the option selected that said "Prefer public JRE, but use JDK runtime if newer," not thinking anything of it. The exe worked perfectly fine on my computer, so I sent it out to a few friends to have them test it out, and it didn't work.
Turns out what had happened was the exe was running using my version of JDK, instead of using JRE. I tried making the executable again, this time selecting the option of "Only use public JREs." When I built the executable this time, it wouldn't run on my computer either, even though I have the latest JRE version installed, so I obviously think that somehow the runnable JAR file is being built without being able to be ran using JRE instead of JDK.
I've looked in the export options for eclipse, but from what I can tell there's nothing I can change when exporting the runnable jar file to change how it runs.
Any help would be greatly appreciated.
Okay, so after some digging into the settings on a project I figured out how to get it to work.
You need to right click on the project you're working on in Eclipse.
Properties > Java Compiler
Under JDK Compliance, you need to uncheck "Use compliance from execution environment
'JavaSE-14' on the 'Java Build Path'
Then under "Compiler compliance level:" you need to click on the drop down and choose 1.8.
After that you can export it as a runnable JAR and then convert it to .exe and everything should work perfectly!

Cannot add java 11 jre in STS version 4.5.0

I am trying to migrate my Springboot projects from Java 8 to Java 11 although I'm having issues first on updating the installed jre of my STS. Since java 11 doesn't have any separate jre, unlike the previous versions, I was trying to include the jdk 11. Although as you can see on the bottom photo, it does not seem to locate the jrt-fs.jar file.
I've also tried to configure the SpringToolSuite4.ini file by including these lines:
-vm
C:\Program Files\Java\jdk-11.0.7\bin\javaw.exe
This is how my .ini file looks like:
Although nothing still happens. Anyone who has other pieces of advice on where I should check? Thank you in advance!
In the preference for configuring the JREs you should select the JDK folder itself, not the lib nor the bin folder. Eclipse will find all the necessary files and libraries that are included in that JDK and can deal with JDKs >= 11.
Please note that this preference is different from the VM that you specify in your ini file. The VM in the ini file is used to run the IDE itself, not to compile your projects against or run them. It is a totally separate thing, which allows you to run your IDE on JDK11 (for example), whereas at the same time you can implement and run projects on JDK8 or JDK14 (or whatever).
You are adding the lib/ dir instead of bin/.
Don't forget to add bin/ to the %Path% environment variable.
Make sure you don't have duplicates from earlier versions of the jdk/jre.
Sorry, you are adding the jdk instead of the jre that is expected:
https://www.java.com/de/download/help/download_options.xml

How can I indicate to Eclipse where my runtime libraries are?

I downloaded JavaFX SDK which contains some jar files in lib, and some dll files in bin.
I included only the jar files in Eclipse so there is no compile problem, but when I run the project I get "JavaFX runtime components are missing, and are required to run this application".
How can I include the dll files for the javaFX SDK too in Eclipse.
Note : I tried to use e(fx)clipse as an alternative to this but it doesnt work for me, so I'm trying to install javaFX manually.
Have you included your new JDK in Preferences -> Java -> Installed JRE ?
If yes, then in Debug Configuration : yourProject -> JRE use Alternate JRE that JDK

E(fx)clipce with Inno Setup wrong jre folder name

I am following JavaFX tutorial found at
http://code.makery.ch/java/javafx-8-tutorial-part7/
which describes how to create native installer with 'Inno Setup'.
I am using e(fx)clipse 4.4 with java 8 JRE installed only and 1.8 compiler
and i do it for windows (exe).
Everything works fine, but when i install exported native application it create folders for JRE
runtime/jre8/
program wont start and says
jvm.dll is not found in bundled runtime.
if i change manualy runtime/jre8/ to runtime/jre/ - it start without any problem.
I did not found any settings in project for specifing runtime path.
How do i make my native installer make right path for runtime?
Solved. Just noticed that i was using standalone jre for project c:\dev\java\jre8 but supposed to use jre from jdk package c:\dev\java\jdk1.8.0_05\jre.
Now installer creates proper path for runtime - runtime/jre/

JDK for Eclipse(in windows platform)

My qustion is really simple, all in the title.
After some tests I found that by given a JRE/bin directory in the path(environment variable) , Eclipse can run normally with no problem. And Eclipse will never try to find the JRE by using JAVA_HOME variable.
And in eclipse, I know that I can add installed JREs in the window preference and choose a JDK folder instead of a JRE folder. And for each project, we can change the compiler level.
Since Eclipse can also compile the codes, when is JDK used? Debug? or what?
Eclipse uses its own compiler to compile Java code. It is different than the javac compiler that comes with a JDK. In fact, you don't need a JDK to compile and run normal Java projects in Eclipse. A JRE is obviously needed to reference the required Java libraries.
However if you are using Maven or some other tools that sometimes depend on a JDK component, then you need to install a JDK on your machine. For example, Maven has an option to rely on the tools.jar that comes shipped with a JDK.
Eclipse uses the JRE you specified as default or per project settings. This could be a (only) JRE installation or a JRE from a JDK installation.
I think the more interesting question is: When should I use a JDK instead of an JRE?
The JDK includes tool that are not included in the standalone JRE. E.g. the javadoc.exe for exporting the documentation from javadoc annotated comments in the code. This Program is not included in a standalone JRE. so if you want to export your javadoc documentation you need to add an installed JRE based on a JDK installation first, so Eclipse is able to use the javadoc tool.
It could be a little hard to give a thorough answer to this but I know that at least for using Maven/m2e Eclipse needs to be run in a JDK.
First of all eclipse is a java code it wouldn't run without java installed to prove it (on your personal expence) copy the eclipse folder elsewhere and uninstal the JDK and try to run jave it wouldn't it would output the error message no JDK but instal JDK and run eclipse from the copied location it would run as a first time asking you about the workplace directory!.

Categories