I have coded a really nice application for me and my friends. I compiled it and created an executable jar. It works perfectly on my mac. However, when I shared the program with my friend who owns a windows computer, he couldn't open the file. I had similar problems with my other programs so this it's not about my code.
Asked
Active
Viewed 88 times
-1
-
1Does he have java installed? https://www.java.com/en/download/installed.jsp – serg.nechaev Jun 16 '15 at 10:03
-
1You'll need to be more descriptive about what "couldn't open the file" means. – AlexLordThorsen Jun 16 '15 at 10:13
-
yes he has java installed he has a message that pops and says : a java exception has occurred . That message pops when he opens the executable file . – Vassili Imanov Jun 16 '15 at 14:38
-
removing more general tags, and those about osx which is working fine. – Barett Jun 19 '15 at 02:45
-
Can you include the stack trace from the exception that he sees? It will help to figure things out. Did you do any file operations from your code? It might not be performing those ops in a multiplatform away. We will need to figure out where the error is and check that part of your code to be able to help. – Barett Jun 19 '15 at 02:46
-
What command is your friend using to run your jar? (Just to follow up on the title of the question, you do not need to recompile the jar for windows. Jars themselves are runnable on any platform. The code may need to change to support the other OS'es however.) – Barett Jun 19 '15 at 02:47
1 Answers
0
Java by it's nature should be OS independent.
with that said there's some pretty good reasons why you can't run a .jar file.

AlexLordThorsen
- 8,057
- 5
- 48
- 103
-
it's not the first one for sure. The second one doesn't seem likely either. I don't understand what the third one means. For the fourth one, can't I just distribute a jar file ? – Vassili Imanov Jun 16 '15 at 14:47
-
-
What version of Java did you compile with? What version is on their machine? – AlexLordThorsen Jun 17 '15 at 02:50
-
when I run it in console mode, it says it can't find the main class – Vassili Imanov Jun 18 '15 at 13:39