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



Question:

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.


Solution:1

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.


Solution:2

Adding Go to the list.

To enable cross compilation in go you have to re-compile the runtime and standard library:

cd /usr/local/go/src  for os in linux windows darwin; do    GOOS=${os} GOARCH=amd64 ./make.bash â€"no-clean  done  

And then specify the target OS before compiling:

GOO=linux go build yourprojecthere  


Solution:3

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.


Solution:4

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!


Solution:5

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!


Solution:6

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


Solution:7

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.


Solution:8

As stated by others, your best bet for exacty what you are asking is C, it will compile on almost any platform, as its effectivly a "high-level assembler."

That said, to achieve the goal you want, a managed language is going to be your best bet. Something like Silverlight for Windows/OSX (and Moonlight for Mono on Linux) is going to be your best bet, additionally it will provide code-once deploy everywhere solution.

Adobe Flash/Flex/Air would be another option, which will give you compile once deploy anywhere, I know thats not what you asked for, but it is the closes to achieving the goal of a simple user expeirence.


Solution:9

JavaScript always . It's a Interpreted language , cross platform and the source code is directly converted into machine code with the use of interpreter . Any non-computer science background user can use it just by double-click with out any extra configuration .


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »