1

I build applications using C++, C# and Java. But when I try to copy the output file to another machine it won`t work ... and for the Java, I have to copy the source code, install the SDK and jun it through the CMD or through a compiler ... I want to know how to use the .exe files created by C++ and C# to be used on other machined without the need to install the Visual Studio or any other compiler ... And for the Java, I want to know how to export my code to an executable application.

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
sikas
  • 5,435
  • 28
  • 75
  • 120

2 Answers2

2

In the case of .NET (C#) you don't need any compiler; build it as an exe, and ship that to any computer with a .NET runtime. For windows and MS .NET, just run it. For mono, you'll need to tell mono to run it:

mono my.exe

As it happens, the C# compiler (typically csc) is normally available in the framework, but you shouldn't need it in this case.

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
  • I`m using the visual studio for developing both C++ and C# ... how can I achieve that using the Visual Studio ... I heard that it can be done through the visual studio. – sikas Mar 22 '11 at 18:41
1

As for Java: build a JAR file with a correct manifest and it should run on any machine with a JVM of at least the required version (i.e. for Java 5 code JRE 5+). You could also distribute the code as a bunch of .class files in directories, but that's not the standard way.

As for C++: Compile the application for a specific platform and supply the needed dlls (e.g. the microsoft runtime redistribution package).

Thomas
  • 87,414
  • 12
  • 119
  • 157
  • how can I build JAR files? And is there any way to make the JAVA files in the EXE format? – sikas Mar 22 '11 at 18:40
  • @sikas Once a Jar (of a GUI) is made, offer it off a web site launched using [Java Web Start](http://stackoverflow.com/tags/java-web-start/info). To ensure a suitable minimum version of Java is available, use the deployJava.js (linked from the JWS info page). That will work not just for Windows, but for other systems for which Java is available. – Andrew Thompson Mar 22 '11 at 18:47
  • what about C++ and C#? I use the visual studio and I heard that this can be done using the VS. – sikas Mar 22 '11 at 18:51
  • you can use Ant tool with InnoSetup and Launch4j to create Java-based exe installer: http://stackoverflow.com/questions/3116126/how-to-create-an-exe-file-in-java/3116293#3116293 – eee Mar 22 '11 at 22:54