Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What languages allow cross-platform native executables to be created? [closed]

I'm frustrated to discover that Java lacks an acceptable solution for creating programs that will run via double-click. Other than .NET for Windows, what modern and high-level programming languages can I write code in that can be compiled for various platforms and run as a native/binary in each (Windows, Linux, OSX (optional))

Assuming I wanted to write code in python, for instance, is there a cohesive way that I could distribute my software which wouldn't require users to do anything special to get it to run? I want to write and distribute software for computer-illiterate and Java has turned out to be a real pain in this respect.

CLARIFICATION: When i say cross-platform I mean that there are ways I can compile my source code using different compilers for each target system. I don't need a compile-once solution... I just want a simple experience for users of the software even if I need to compile it and work out code issues for each target platform.

like image 265
JT. Avatar asked May 01 '10 01:05

JT.


6 Answers

C++

Take Google Chrome. It is a new web browser, and an excellent example of native multiplatform application and it's written in C++.

Of course, they have to "work out code issues for each target platform" as you said, but it certainly works!

like image 77
OscarRyz Avatar answered Oct 16 '22 16:10

OscarRyz


C is the closest you're going to get.

The languages that provide for the best cross-platform execution are going to be those that do not run native code, like the Java platform and the .NET framework. You can also use an interpreted, rather than compiled, language.

I have been experimenting with Mono and C# with Winforms. It has proven to be a pretty good combination so far. In Windows, the executable can be run by double-clicking on the executable directly, or creating a shortcut for it that can be double-clicked. In Linux, the executable can be run from an icon that executes a small script, and the user experience is essentially the same.

I think you can expect a similar experience with Python.

like image 24
Robert Harvey Avatar answered Oct 16 '22 16:10

Robert Harvey


Rust should be in this list.

  1. Install the Rust toolchain from https://www.rust-lang.org/en-US/
  2. cargo new "my_first_rust_progam" --bin
  3. cd my_first_rust_progam
  4. cargo run

No really that's it. No pre-installation requisites for runtimes or frameworks for end users. It's really that simple. You just wrote and compiled a tiny "hello world" source to a native binary and executed it too.

There's nice Documentation at https://doc.rust-lang.org/ to get you started. Learn Rust today!

like image 26
Harindaka Avatar answered Oct 16 '22 15:10

Harindaka


If you're used to Delphi then Lazarus can provide a similar environment, yet allow cross-platform compilation. Unfortunately you can't just take your VCL components and drop them in, since those tend to be Windows-specific/-centric. Some providers of VCL components do also provide LCL versions though.

like image 39
Ignacio Vazquez-Abrams Avatar answered Oct 16 '22 17:10

Ignacio Vazquez-Abrams


I had a very good experience with Delphi from Borland compiled in windows, it was perfectly running using Wine, Delphi by default compiles all in one exe. Just avoid to use the Win32-voodoo library.

The other option to cross compile it's C\C++, eclipse and gcc, you can compile also architectures different by i386

like image 20
Cesar Avatar answered Oct 16 '22 16:10

Cesar


It is possible and rather easy to 'compile' Java programs to different platforms. You could convert them to executable .jar files, or you could use a program such as JSmooth.

If you need to be able to compile it for different platforms, you could use an interpreted language like Perl and compile it to C code. Since C can be easily compiled on the target platform, the user does not need an interpreter.

like image 23
Hawkcannon Avatar answered Oct 16 '22 15:10

Hawkcannon