Is it possible to create a executable jar file coded in java12 while java8 is still installed?
We use java8 in university but privatly im coding in 12 and so i need to find a way to run a private coded program through a jar file (created with artifacts through intellij) but still keep the java8 installment for university.
i tried this command
start javaw -jar jogurtLaunch.jar
and i tried rightclick and 'open with' and using the java12 exe (both java.exe and javaw.exe), but nothing happens except for the windows cmd prompt popping up for a few milliseconds in case of the exe and a jvm error ('Error: A JNI error has occurred, please check your installation and try again') popping up in case of the command.
Also i'd prefer a solution that is usable on all computers and not just for java12 development pcs.
Is there a way or do i have to code it in java8?
Related
Environment: Windows 11
Problem: cannot open .jar file(the MARS assembly language simulator)
Hello, I am currently trying to install the MARS assembly language simulator. It is a .jar file so I downloaded java to open it. However, I still can't open the file even with java downloaded.
I checked if java was installed using my cmd:
Command prompt showing java successfully installed
I tried double-clicking it did not work. So I right-clicked it to open with other apps. But I did not see java in the given options.
Cannot find the java option to open the file
Thank you so much for helping!
Use your prompt
CD into the directory with the jar
then execute
java -jar Mars.jar
...any more troubles , open file properties tab with right click on the jar and check permissions to execute the file.
Installing Java usually means installing a JVM, which is a Java Virtual Machine. You won't be able to launch files from a Windows context menu like this, because "Java" is not a program that opens files.
Instead you need to:
Either a terminal and call javaw.exe with the parameters -jar and your .jar-file. E.g.:
C:\your\java\binaries\javaw.exe -jar -SomeJarFile.jar
Or add the Java installation to your environment variables, then you can call javaw.exe without providing some specific path
I have created a java program (in Eclipse). I have successfully compiled it to a .jar file which I can run on windows without any problems. I want to give this program to a friend who has a MacOSX. So my aim is to:
Create a file which can be run on MacOSX
The twist is that I have to configure it on my Windows computer since I don't have access to a Mac. Any advice would be of great help!
I am not sure what you are referring as "create a file which can be run on macOSX"
If you want to run on any OS you just need a JRE on that particular system without it you cant run. It will provide a runtime environment to run a jar file. Then use below command to run the jar.
java -jar Myjar_file.jar
First thing I installed Java jdk and jre
Then I installed a file called ssh_rd_rev04b.jar
I tried to open the jar file but it didn't run
I double clicked it,
I made a .bat file and typed java -jar filename didn't work too, tried other things but didn't work as well .
Please help .
Okay so I have been coding a game for a while now and I am hoping to release its alpha just one problem. I don't know how to export it and run it. Please note that all my code works fine. So when I export it I export it as a Runnable jar file once I do so I set it and have tried both exporting it as .jar and .exe. Once I exported it I tested it by clicking the resulting file but it doesn't open the application but rather it opens it in eclipse encoded. Please help I may just be an idiot.
you have to try to launch it with:
java -jar yourrunnable.jar
If you plan to run on windows and you want a .exe file, try to check this SO question: How can I convert my Java program to an .exe file?
or if you want to target a mac, you can have a check here:
http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/packagingAppsForMac.html
Basically any platform you target you have some customization in order to achieve a seamless run. Anyway the most cross platform solution is the Java -jar way.
I had the same problem with .jar files not opening on a double click. It turned out that I had two versions of Java installed (Java 6 and 7). Uninstalling Java 6 from Control Panel-> Uninstall a Program was what finally allowed .jar files to open on a double click without using the command window.
What is listed in right-click-> Open With ? Is some other program listed as the default program ? Is a Java Runtime listed ? If a Java Runtime is listed, you can open with it, and make it the default program to run with.
Right Click -> Properties -> Change -> C:\Program Files\Java\jre7\bin\javaw.exe
For Java 8 use below
java.exe -jar myFile.jar
I'm having issues running a jar file I compiled from an eclipse project. I'm fairly new to Java so I'm likely missing something simple.
When I run the jar file from the command line:
javaw -jar test1.jar
the program runs fine. But when I double click the jar it doesn't run. I believe the issue has to do with 32 bit versus 64 bit java (double clicking the jar file opens the "javaw.exe *32" process whereas running from the command line opens "javaw.exe"). I'm using the swing GUI libraries, if that makes a difference.
Is that the issue?
Is there a way to make eclipse export a .jar file that will be compatible with "javaw.exe *32"?
Thanks.
EDIT:
I figured out the error was related to using generics with JList, which is only supported in Java 7. Double clicking the .jar was running a 32-bit version of Java 6, which is what was throwing the error. Thanks for the help guys