I have made a java application using jdk 8 and then made an executable file from the jar.
Then I updated my system to java 11, and deleted all older java versions from my system, and when I run this app from exe file it can't run and takes me to web browser and asks me to download java 8. But if I run the jar using java -jar app.jar it runs normally on java 11.
I've used launch4j to make an exe out of jar, and there is no possibility to pick java 11 as the newest version.
So how can I make this exe run on java 11?
Unless you have compiled EXE with latest launch4j 3.12 you are most likely stuck on Java 8. Support for newer JDK was added in ticket #177 Launch4J doesn't accept Java 9 JDK.
The solution would be to recompile EXE with latest launch4j and hope it works with Java 11. Alternatively you could create a BAT file running java -jar app.jar but that goes against the whole point of launch4j.
Related
I created a program using Java 8(JDK 8), but when I try to run it on a device that isn't mine (so no JDK), it makes me download a JRE.
1) why don't all programs when you download them make you do this? Is it just most programs aren't using Java?
2) how to I create an installation exe to install the JRE and the program. (As of now I'm just running my program as an exe).
Is it just most programs aren't using Java?
Yes, java is a popular programming language but most (desktop) applications are not written in java.
Some programs do also come with a JRE, meaning that it is installed with the program.
how to I create an installation exe to install the JRE and the program.
The exe could try to download the JRE from the API of e.g. OpenJDK, execute it and wait until it finishes, you could bring an installer with you, you could tell the user to install a JDK or you use an installer template that does one of the things for you.
I have a few applications that I am giving to my colleagues on customer support. I made all of these applications using JRE 1.8, and most of the machines that are being used are using a JRE of 1.6 or 1.7. I have refactored the code so that it will work with these versions of Java.
However, how am I supposed to test that these applications will in fact run on a machine with these versions of Java installed? Do I have to use another computer? Is there any way of testing this from my own PC?
I'm using launch4j to create an .exe file that will run the application (they're just tools to help some troubleshooting processes)
Just to try be more clear, I have the latest version of Java installed on my PC, and I want to test that PCs with Java 1.6/1.7 will still run the .exe file generated from launch4j; so how do I do this on my own PC?
In your IDE (for example eclipse) you can change the project properties
for the java compiler "Compiler compliance level" from 1.8 to 1.6. Then
build the new code.
(By the way, if you like to support Java 1.6 you should only compile with
this compliance level)
If you have still installed old Java-JRE-Versions on your
PC you can set JAVA_HOME environment to the JRE 1.6 folder
(Checks %PATH% too and rename your java 8 JDE and java 8 JRE folder
temporaerly for safety).
I have bothe that java 1.7 JDK installed and the Java 1.7 JRE installed and for some reason, i can use the JDK in eclipse but if i am going to run any java program then i am forced to use a batch file. My path is: "C:\Program Files\Java\jdk1.7.0_51\bin\javaw.exe\" but for some reason the jre inside is not registering
I have a jar file that I created on my PC using Java 7. I want to run it on my lab server which only has Java 6. I try to run the jar file: java -jar file.jar but there was a UnsupportedClassVersionError exception.
Since I have no root right, I cannot install the new Java 7 on the server. However, I can download JDK7 to my working folder (let say /home/jdk7)
Is there a way to run the jar file by specifying the jdk path to /home/jdk7 ?
Thanks.
You can use the java executable from your private JRE/JDK installation explicitly. If it's installed in /home/jdk7/, the full command line should be:
/home/jdk7/bin/java -jar file.jar …
Alternately, you can make this installation's executables the "default" by prepending them to your PATH, by using the following in ~/.bashrc or ~/.profile. (One of those or both will be correct for your lab system, I'm not sure since I use fish.)
export PATH=/home/jdk7/bin:$PATH
Note: this will only help if it's in the environment of the logged in user.
You can't. You can run Java 6 projects on Java 7, but not Java 7 projects on Java 6. This is because you can use some instructions in Java 7 that don't exist in Java 6. I've got this problem sometimes too.
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.