I have a Java jar of which I would like to turn into a .exe file for Windows. Only problem is that I get the following error when building it through Launch4j on Linux net.sf.launch4j.ExecException: java.io.IOException: Cannot run program "/Desktop/launch4j/bin/windres": error=2, No such file or directory. I am not completely sure what is wrong, as I have tried to use the same Launch4j setup along with the same jar with Launch4j but on a Mac instead, which worked perfectly.
I have tried to search for the error on Google, but I wasn't able to get any results and on the Source-forge page with the actual download link, there are no one who have mentioned this error, at least it seems.
To me it appears as if there is something missing in the Launch4j folder? When launching the Launch4j jar to use the program, I am using the following command in the Linux terminal Java -jar launch4j and the program does open, the error first appears when trying to build the executable.
I had the same problem with launch4j on MACOS while using the launch4j ant task. I could solve the problem by copying (not moving) the macos executable located in the launch4j/bin to a newly created sub director launch4j/bin/mac. So I have got:
-launch4j/bin
ld
windres
-mac
ld
windres
Related
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 need to run a .jar in MATLAB, exactly as described in this original question I found in my search of Stack Overflow: how do I run a java .jar in Matlab I was having the same issues as the user here (got the same errors, did the same troubleshooting) The only difference is that I am running Java 1.8.0_144-b01 vs Java 1.8.0_121-b13 in the linked example.
However, when I tried the solution that worked in the above situation...
system ('java -jar C:\My\Java\Class\Path\To\MyJar.jar')
...I got the following message: "'java' is not recognized as an internal or external command,
operable program or batch file. "
The .jar is in my static path. The current directory is set to where the .jar file is located. Any help greatly appreciated.
I'm trying to make my java application distributable.But when trying to package as exe installer from netbeans I'm getting this error. Can't understand how to do it. please help. thank you
Detected JavaFX Ant API version 1.3
Execute failed: java.io.IOException: Cannot run program "iscc" (in directory "C:\Users\Hansi\Documents\NetBeansProjects\medical"): CreateProcess error=2, The system cannot find the file specified
C:\Users\Hansi\Documents\NetBeansProjects\medical\nbproject\build-native.xml:441: Error:
JavaFX native packager requires external Inno Setup 5+ tools installed and included on PATH to create EXE installer. See http://www.jrsoftware.org/
It appears that what you are invoking wants to run a program on your system which you don't have.
You need to install that program properly so it can be invoked manually from the command line, and try again. Instructions can be found in the stack trace. If the website is down you will need to find an alternate source.
I'm having a strange issue trying to run classes from an executable .jar file on Linux that none of the existing question threads I've sorted through seem to be able to resolve. I'll preface this in that I've never had to use Linux before and am only using it in this situation out of necessity, so it's possible I have overlooked something simple that I just didn't know could be causing the problem.
I can launch the classes from my .jar file without any issues on Windows via a .bat file with the following settings:
start "MyServer1" java -classpath ./*;Server.jar infoServer/StartInfoServer
start "MyServer2" java -classpath ./*;Server.jar loginServer/StartLoginServer
start "MyServer3" java -classpath ./*;Server.jar chatServer/start
start "MyServer4" java -classpath ./*;Server.jar gameServer/start
However, when I move to trying to launch these classes from the .jar on Linux, I get a "could not find or load main class" error. My .sh file is set up like this, and is placed in the same directory as my .jar file:
echo Starting Servers
java -cp Server.jar infoServer.StartInfoServer
java -cp Server.jar loginServer.StartLoginServer
java -cp Server.jar chatServer.start
java -cp Server.jar gameServer.start
echo All Done Starting Server
I've used ls from the Terminal to verify the .jar and .sh were being recognized as existing where they should be. (For future note, I'm using the Terminal from inside the directory containing my files.) I've made sure to make use of chmod to be sure both the .jar and the .sh have read/write/execute permissions and used ls -l to verify those permissions were indeed present. I've tried various forms of explicitly defining the classpath, such as using "/home/machine/Desktop/Folder/MyJar.jar", using pwd from the Terminal to ensure I'm getting the filepath correct. I've checked over my Java compatibility. (1.7.0_65 on Linux, 1.8.0_45 on Windows, with the .jar being created in Eclipse using 1.7 Compliance settings.) I can use unzip MyJar.jar from the Terminal and it will properly extract all my class files, allowing me to verify that my .jar isn't corrupted on my Linux machine and that the paths to the classes I'm trying to run are still the same on Linux as they are on Windows.
I do apologize if this is just a problem of inexperience overlooking something, but I can't think of or find any indication of what the problem could possibly be.
EDIT:
I've updated the question with some screenshots related to the problem:
https://gyazo.com/0ae2a2701aae734db21ef7c29200283b - General File Setup.
https://gyazo.com/d735d9cee57b4a92078c4b624d012b8c - Running the Shell via Terminal.
Other notes: jar -tf Server.jar works from the Terminal but not from inside the Shell script, which leads me to believe this may be some kind of visibility or pathing error, but I can't find any reason why that would be the case.
I have made a simple game that I want to convert into a runnable jar so I can show others and launch it without Eclipse.
In Eclipse I:
Right clicked on Project
Export
Java > Exectuable Jar File
Launch Configuration: CTB (1) - Click The Block
It made a jar with a MANIFEST.MF containing:
Manifest-Version: 1.0
Class-Path: .
Main-Class: uk.co.robertmerriman.ctb.main.CTB
This was all extracted to my desktop in Click-The-Block.jar
When I double click, nothing happens.
When I type "java -jar Click-The-Block.jar" into CMD, I get the following error:
Error: Unable to access jarfile Click-The-Block.jar.
Make your jar file name without spaces locally, then write in cmd like the following:
java -jar YourjarFileNameWithoutSpaces.jar
Looks like an OS issue. If you are running windows 07 or vista try running the same in administrator mode.
Also make sure that when you are running the command
java -jar Click-The-Block.jar
You are running it from the directory where the jar is located.
if your java.exe is in c:\java\bin\java.exe and your Click-The-Block.jar is in c:\dev\
Then try out the following command
>
c:\java\bin\java -jar c:\dev\Click-The-Block.jar
Also try renaming your jar file with no cps letter, i know this will not have any effect but there's no harm in trying.
If you are still not able to execute the jar then try downloading an executable jar file from the net and see if you are able to run it using the standard java command. If you still get the same error which means the problem is not with your jar but somthing to do with how java is configured in the system. In that case you can go ahead and reinstall a fresh jdk and try al over again.
Hope it helps ...
I had the same issue with my executable jar generated by maven-shade-plugin "DCD-Desktop-1.0.jar" , I removed the dashes and renamed it to "dcd.jar" and it worked fine .