How to finish a program!

  • (2 Pages)
  • +
  • 1
  • 2

15 Replies - 906 Views - Last Post: 13 August 2012 - 11:31 AM Rate Topic: -----

#16 cfoley  Icon User is online

  • Cabbage
  • member icon

Reputation: 1547
  • View blog
  • Posts: 3,322
  • Joined: 11-December 07

Re: How to finish a program!

Posted 13 August 2012 - 11:31 AM

Understanding the design principles behind Java and c++ might not be an immediate help to you but it might help you see why some options seem to be closed to you when working with Java.

c++ is designed to be a system language. It is important that it can interact with your hardware and that you can use it to write low level things like device drivers. As such, the compiled code must be executable directly by the hardware, or at least the operating system. A side effect of this is that to get it to run under a different configuration, you must compile it again for that system. This may or may not involve modifying your source code too.

Java was designed to run on the JVM (Java Virtual Machine). This increases its portability by, ironically, not running directly under any particular hardware setup. Instead, any Jar file or class file can be run on any system that has a JVM installed. It's almost like being able to open any *.txt file as long as you have a text editor.

What most popular Java applications tend to do is bundle different distributions for different operating systems. They have a raw jar file for people who know what they are doing. For Window they bundle the same jar file with a native launcher. All the launcher does is make it easier to launch via double click and allow a custom icon. Sometimes they include an installer too. I don't use macs much so I'm not sure what tends to happen there.

One way that might suit you is to write a one-line batch file:

@java -jar myjar.jar

Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2