0

Okay, so I have made the java application using NetBeans, and I have ran and build it do that way I have a jar file. How do I from here make it to where I can share this with other people and the can install the application onto their computer? Also, a side note I am using a MacBook Pro if that makes a difference.

  • 3
    Possible duplicate of [How do I make my program, written in Java, usable to other people?](http://stackoverflow.com/questions/7533433/how-do-i-make-my-program-written-in-java-usable-to-other-people) – Mick Mnemonic Oct 17 '15 at 01:40
  • If you already have a .jar file, you can just send that to the people you want to share it with- all they'll have to do is double click to open it and it'll work! – nbokmans Oct 17 '15 at 01:41
  • Sorry I did a search for my question I did not see it, but I will look a bit harder next time, thanks! – midnightshadow Oct 17 '15 at 19:14
  • Just adding this as a reference because it explains things fairly well: http://www.excelsior-usa.com/articles/java-to-exe.html – Matt Oct 21 '15 at 05:14

4 Answers4

0

You could send the projectname.jar file to other computer and execute with command

java -jar projectname.jar

If you have some difficult check the documentation: https://docs.oracle.com/javase/tutorial/deployment/jar/run.html

OR

First: Check if the other computer have JDK installed with command java -version and javac -version

Second: if everything is ok, share your source file "projectname.java", than execute javac projectname.java && java projectname, don't forget to do this inside the source folder

Exemple: If my source file was on my Desktop, i type cd Desktop and than the commands javac and java

Don't forget, you need run the file that contains main!!!

Good Luck!

EDIT:

Follow this tutorial https://www.youtube.com/watch?v=mm_-mnDKAjo

Than, change the icon with right click the exe file, select Properties and click the "Change Icon" button adding the icon that you want.

Filipe Filardi
  • 170
  • 2
  • 12
0

Much better to create installation package. See this link https://netbeans.org/kb/docs/java/native_pkg.html#se

Ivan Dubynets
  • 342
  • 1
  • 3
  • 12
0

Share Source code (.java) through svn or git. If you want easy public access, I can suggest a cloud service like GitHub. Share binaries through a dependency management tool like maven.

YoYo
  • 9,157
  • 8
  • 57
  • 74
0

I think the key point here is that 'Microsoft Word' is a native Windows executable, and Java programs are not.

Microsoft Word is written in C++ and compiled by a Windows C++ compiler to a native Windows executable format which Windows recognizes and will run if you double click on the icon on the desktop.

Java programs run on the JVM (Java Virtual Machine). If you download and install the JRE (Java Runtime Environment) on Windows, you can then run Java programs in the JVM by typing java -jar myProgram.jar

There are tools that can wrap your .jar file in a native Windows .exe, you might like to look at:

http://launch4j.sourceforge.net/

and specifically the Docs page:

http://launch4j.sourceforge.net/docs.html

which shows how to specify the configuration file. Once you have a configuration file setup, you can run:

launch4jc.exe config.xml

to spit out your new myProgram.exe file that you can distribute.

Matt
  • 3,677
  • 1
  • 14
  • 24