My Java program is in working order when i use it under Windows(Eclipse and Bluej). I compress it to a Jar and send it to my red hat and bang. nothing works. It breaks on the weirdest things, such as text field set text will not show, JPasswordfield just disappeared, Java AWT ROBOT dies too... the list goes on, first i thought it must be my Linux JRE is out of date, but i installed latest JRE then the JDK with no improvement at all. I have a feeling that i miss understood the Java cross plat ability. I also tried to remove all of my functions and guts to see what is breaking but it seems every second thing is breaking, other than the some of the major GUI components and most of the back end stuff. basically any thing that uses some thing fancy will blowup in my face, such as making a text field in to a password field...
This is my first time posting ;) please be nice to the newbie!
Thanks!!!
SOLVED!!! Yay. Problem solved!!! It was because my Java path isn't set, so my GCC/GCJ jumped in instead of my oracle java, even tho i used java -jar xxx.jar. so I put in the java directory path from of my java -jar xxx.jar and worked like a charm. unless you set the path, you have have to do this manually
/usr/java/jdk1.6.0_21/jre/bin/java -jar xxxxx.jar
java -version to check if your real java is running or if it s still GCJ
Java on Linux PlatformsThis installs the Java Runtime Environment (JRE) for 32-bit Linux, using an archive binary file ( . tar. gz ) that can be installed by anyone (not only the root users), in any location that you can write to. However, only the root user can install Java into the system location.
Java is cross platform because a program's source code is compiled into an intermediate "bytecode" language. The bytecode is then executed by a Java Virtual Machine (Java interpreter) that was written for that particular hardware platform.
can you elaborate more differences @Joachim Sauer,I had a similar interview question asked once. I don't know why, but in fact Java runs way faster on Linux than on Windows. Compiling an Hybris project on Linux (Ubuntu mate 16.04) took 1/4 of the time required on Windows 10 and 1/2 for server start up.
An overview of the software development process. Because the Java VM is available on many different operating systems, the same . class files are capable of running on Microsoft Windows, the Solaris™ Operating System (Solaris OS), Linux, or Mac OS.
Yes. The class and jar formats are intentionally crossplatform.
Are you absolutely certain that your jar file was copied correctly to your Linux machine? If you used ftp, it is crucial to use binary instead of ascii transfer.
Linux users often run java programs with gcj instead of java. Check that you use a correct executable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With