A few weeks ago I installed Java, set JAVA_HOME on my computer and the JDK in my IDE. Everything worked fine, until today. I got an error when starting my IDE, "Cannot run program" and the path I installed my Java. I checked the path and it's really not there, also "java version" and "java home" commands from the command prompt now can't find it.
I installed it again, and now after a couple of hours the bin folder disappeared!
Adding more info: I'm using java 1.8.0.261
Full error:
Cannot run program "C:\Program Files\Java\jdk1.8.0_261\bin\java.exe" (in directory "C:\Users[my_username]\AppData\Local\JetBrains\IdeaIC2021.2\compile-server"): CreateProcess error=2, The system cannot find the file specified
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
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?
I am running Windows 10 and I recently ran into a problem with opening Eclipse. Originally, I was unable to use the javac command on command prompt because of a message that said: "javac is not recognized as internal or external program". To fix this, I went into the environment variables and added the PATH variable, which was not there before, and made the address to the bin folder in my Java folder. This fixed that problem and allowed me to use javac and run my files, however, now I am unable to open Eclipse. Whenever I run Eclipse, The program starts to load then fails and refers me to the log. In the error log I get this:
So far, I deleted that PATH variable then retried Eclipse and an error message said it was unable to find a javaw.exe file. I found my java files and put the path to that file in my eclipse folder and tried eclipse again. This time, eclipse started to load but then failed and referred me back to the error log. It seems that eclipse is able to find the javaw.exe file but I'm not sure what else is wrong now.
My Eclipse and Java versions were not compatible. IF anyone else has this problem make sure of that first. After fixing this, I went to the PATH environment variable and I was able to add multiple paths, so I added both of these:
C:\Program Files\Java\jdk1.8.0_161\bin
and
C:\Program Files\eclipse\jre\bin
The first path is necessary to use javac from command prompt. The second address is necessary for eclipse to access the javaw.exe file.
Shell cannot run executable file eclipse even if I enter proper path. the file is executable and readable.
Why bash cannot find the file?
I've also install java (openjdk-7-jre), and normal eclipse is running well
~/eclipse:
about_files eclipse.ini icon.xpm notice.html
about.html eclipse-wrapper jre plugins
configuration epl-v10.html libcairo-swt.so readme
eclipse features LICENSE.TXT startup.jar
$ ./eclipse
bash: ./eclipse: No such file or directory
It could have to do with 32 bit vs 64 bit. If you download the wrong package for your architecture, you could end up with this message instead of a more informative message saying that you are running the wrong version of eclipse for your machine
A couple of days ago i installed the latest Java update. in the process i believe something may have gone wrong, as now when i try to open a jar file (double clicking it) it just pops up a terminal window which displays something like:
Cannot find main class "..."
However, if i try to run it straight from the terminal with:
java -jar foo.jar
it will run fine. I have tried doing a full re- install of the JRE and JDK, just for good measure but this has had no effect. Has anyone got any recommendations?
I am using Windows XP with Java 7 update 7.
1. First type java -version from your command prompt, if this command displays the installed JDK version, then you JDK path is perfectly fine.
2. Secondly Perhaps your file associations got messed up. At the command prompt, try running
ftype | find "jarfile"
On my 64-bit Windows 7 computer, that shows
jarfile="C:\Program Files (x86)\Java\jre6\bin\javaw.exe" -jar "%1" %*
You can also change it with ftype:
ftype jarfile="C:\Program Files (x86)\Java\jre6\bin\javaw.exe" -jar "%1" %*
Also of note was the fact that the application install could be doing a silent install of the JRE, which (silently, of course!) does not associate .jar files correctly. So you have to change the main program install to no longer do a silent install, and also clean up the file associations. After reinstalling the JRE, you could execute the .jar file by double-clicking on it