1

Well, i have the folder of the java program that i made with eclipse and it contains the .java and .class files along with some folders that contain images and text files needed for the proper program's operation. My question is, how can i make a whole executable(.sh in this case) program, that works exactly as i have compiled it run it? For example, i let people download it and i want them to run it just by typing ./(filename).sh .

Since i wrote the program on linux, and i have to test it on linux at the moment, how is possible to make the exact same work on windows machine?(i will transfer the eclipse project)

Thanks in advance.

woopsi
  • 19
  • 6
  • for the linux portion, this might be related [How to convert a .java or a .jar file into a Linux executable file ( without a .jar extension, which means it's not a .jar file )](http://stackoverflow.com/questions/29429976/how-to-convert-a-java-or-a-jar-file-into-a-linux-executable-file-without-a) – chickity china chinese chicken Jan 05 '17 at 19:55
  • windows part possibly relates to [How do I create executable Java program?](http://stackoverflow.com/questions/804466/how-do-i-create-executable-java-program) – chickity china chinese chicken Jan 05 '17 at 19:57
  • will the "users" have to get the textfiles/images so they can properly use the program? – woopsi Jan 05 '17 at 19:57
  • Also, i have .java files, not .jar – woopsi Jan 05 '17 at 19:57
  • 1
    Here is one way. Still requires a JRE on the target system: https://coderwall.com/p/ssuaxa/how-to-make-a-jar-file-linux-executable .As for getting a JAR, use Eclipse's Export JAR functionality. –  Jan 05 '17 at 20:04
  • Use eclipse build in functionality to export jars. **Remember to export all necessary files!** Then you can use `java -jar your_exported_jar.jar` – Alex Baranowski Jan 05 '17 at 20:23
  • tried to export via eclipse and had 2 problems. First is that i can't add the image/textfile directories to the jar export, second is that even i tried just with the java files, i got the "Error: Invalid or corrupt jarfile foodproject.jar" error. – woopsi Jan 05 '17 at 20:39
  • update: managed to get all the folders together in the project, made it a jar file but when i try to make it executable, i get an error that says that the jarfile is corrupted. – woopsi Jan 05 '17 at 21:08
  • [Corrupt jar file](http://stackoverflow.com/questions/7559072/corrupt-jar-file) – chickity china chinese chicken Jan 06 '17 at 17:43
  • Thanks! it worked :) – woopsi Jan 07 '17 at 09:25

0 Answers0