javajar.class-file

Does a .jar file need all of the classes installed on a machine to run?


Does a .jar file need all of the classes installed on a machine to run? For example: if I ever distribute a program as a .jar file, will I also need to install all my .class files on the user's machine? If so, is there a way to distribute a java program as one file (such as an executable)?


Solution

  • The classes are compiled into the .jar file, so you do not have to install them on every machine. And yes there is a way to distribute an executable .jar file.