+ 1

.jar files not working

I have some code in Java that I'm trying to turn into an executable file, but no matter what I have researched, watched, or tried, nothing seems to get either the .jar file or the .exe file running. Does anyone know how to fix this?

10th Jul 2019, 3:36 AM
Code Babylon
Code Babylon - avatar
21 Respostas
+ 1
i give up, try to ask a new question but mention that you're using eclipse
10th Jul 2019, 7:13 AM
Taste
Taste - avatar
0
hello again, sorry for not replying. as you said there the jar file also isnt running. have you set an entry point for the jar files ? you can check by opening Manifest.mf in Meta-inf inside the jar. and look for Main-Class
10th Jul 2019, 4:32 AM
Taste
Taste - avatar
0
Taste Hi again. How do you do that?
10th Jul 2019, 4:35 AM
Code Babylon
Code Babylon - avatar
0
use archiver program like, winrar or 7zip to open jar file. then extract that file
10th Jul 2019, 4:36 AM
Taste
Taste - avatar
0
Taste What do I do after that? Also, when I double click MANIFEST.MF in WinRar, it says "How do you want to open this file?"
10th Jul 2019, 4:39 AM
Code Babylon
Code Babylon - avatar
0
use notepad, its just a textfile. just to chect that the main class for the jar is defined. its common that jar doesnt have an entry point.
10th Jul 2019, 4:43 AM
Taste
Taste - avatar
0
Taste The main class is MyClass, just like in the code itself
10th Jul 2019, 4:47 AM
Code Babylon
Code Babylon - avatar
0
so its set right ? then try to run the jar file from the command line/terminal. java -jar jarfile.jar
10th Jul 2019, 4:49 AM
Taste
Taste - avatar
0
Taste I got an error that says "Unable to access jarfile NumGrow.jar" NumGrow is the name I gave the file
10th Jul 2019, 4:51 AM
Code Babylon
Code Babylon - avatar
0
it meant the jar corrupted or its not found. are you sure you're running from same directory as the jar file ?
10th Jul 2019, 5:13 AM
Taste
Taste - avatar
0
Taste I ran it from Command Prompt, so going by your words, I assume I had to do it somewhere else?
10th Jul 2019, 5:16 AM
Code Babylon
Code Babylon - avatar
0
navigate to the target directory inside the command prompt. like this cd project/java
10th Jul 2019, 5:30 AM
Taste
Taste - avatar
0
Taste I don't understand. Sorry.
10th Jul 2019, 5:36 AM
Code Babylon
Code Babylon - avatar
0
from the folder use shift right click. then choose open cmd. from there a cmd will appear, then run the the jar file.
10th Jul 2019, 5:40 AM
Taste
Taste - avatar
0
I did it with Windows PowerShell and it works there
10th Jul 2019, 5:43 AM
Code Babylon
Code Babylon - avatar
0
it should be. just in case if its not https://stackoverflow.com/questions/28691344/how-to-call-a-java-program-from-powershell i'm not so familar with powershell
10th Jul 2019, 5:43 AM
Taste
Taste - avatar
0
Taste I think it works the same as cmd in this case
10th Jul 2019, 5:47 AM
Code Babylon
Code Babylon - avatar
0
recompiling maybe ? its strange tbh,
10th Jul 2019, 6:18 AM
Taste
Taste - avatar
0
I tried exporting the code from the Eclipse IDE as a executable JAR file multiple times and turned them into executable files, but none of them work
10th Jul 2019, 6:20 AM
Code Babylon
Code Babylon - avatar
0
Taste Alright. Sorry I was vague
10th Jul 2019, 7:14 AM
Code Babylon
Code Babylon - avatar