From my previous question, I know that JavaFX is not supported in RedHat 5.8 meaning, even when I have Java 8 (jdk1.8.0_05) installed on my Linux, a JAR file created in win7 can't be executed via java -jar helloworld.jar
. Does that mean there is NO way to run JavaFX jars on this machine?
相关问题
- I get an exception when trying to swap elements in
- JFX scale image up and down to parent
- Dragging an undecorated Stage in JavaFX
- JavaFX sample issue
- How to change the font size in ListView in JavaFX?
相关文章
- Low quality icon in taskbar of a Stage. JavaFX
- Loading custom font using JavaFX 8 and css
- Javafx Platform.runLater never running
- JavaFX scrolling table update performance degrades
- Javafx select multiple rows
- Escape from a Number TextField in a JavaFX dialog
- How to merge cells in JavaFX Scene builder?
- Can you specify minor jdk version for travis ci
The problem with running JavaFX applications on RHEL5 is the version of glib that comes with that OS is not new enough. The trick, then, is to provide a newer version of that library and all of the other libraries that depend on it to the JRE. The next hurdle is that RHEL5 shared library loader won't load those libraries. You have to use a compatible loader. But the JVM has the path to the loader hard-coded in the executable! So you need a separate JVM with a custom loader path patched in. Roughly, the steps to get this working are...
Unpack the following packages from RHEL6:
Put all of the shared libraries from those packages in a directory on your RHEL5 system. Let's call it
/YOUR-ALIEN-RHEL6-LIBS-PATH
.Unpack another copy of a JRE to, say,
/YOUR-ALIEN-JVM-PATH
.Use patchelf to point the JVM executable to the new loader.
./usr/bin/patchelf --set-interpreter /YOUR-ALIEN-RHEL6-LIBS-PATH/lib/amd64/ld-linux-x86-64.so.2 /YOUR-ALIEN-JVM-PATH/jre1.8.0_25/bin/java
Run the application after setting
LD_LIBRARY_PATH=/YOUR-ALIEN-RHEL6-LIBS-PATH/lib/amd64:/YOUR-ALIEN-RHEL6-LIBS-PATH/lib/amd64/jli
Although it is not pretty, I have successfully run JavaFX applications on RHEL5 using this method. Having said that, I highly recommend just upgrading your OS if it is even remotely feasible.
Note this builds upon the existing answer from James with more concrete detail
Obtain RPMs from a RedHat 6.x, e.g. http://vault.centos.org/6.2/os/i386/Packages. Copy into directory
rpms/
Extract all the contents from the RPMs into separate directory. Use
rpm2cpio
andxzcat
.xzcat
can be installed from these RPMs if necessary[xz, xz-libs, xz-lzma-compat]
Obtain copy of
patchelf
. I built from source as couldn't find a Redhat 5 RPM. Only requires dependent RPMs[gcc, gcc-c++, glibc-devel, kernel-headers, libstdc++-devel]
Use
patchelf
to set location of redhat 6u2 loader (aka interpreter)Set
LD_LIBRARY_PATH
, this needs to have both/usr/lib
and/lib
, otherwise you get a segfault.(Note that any other applications run after
LD_LIBRARY_PATH
is set other than java which has had its interpreter location corrected will segfault.)Now run java app...
Happy days