views:

238

answers:

6

Sometimes, I want to write an simple application which will works on any Windows machine, without installing any programs or components (ex. .NET Framework), in a C# or Java like programming language. How can I do this?

Thanks.

EDIT: Added the 'like', sorry...

A: 

I have no experience with this tool, so don't know how good or bad it is, but it is what you are looking for.

http://www.xenocode.com/products/postbuild-for-net/

Tanmay
A: 

Both c# and Java require runtime libraries that have to be installed separately from the application.

You could write a standalone application using Delphi for example.

rslite
Delphi is a good idea, thanks.
TTT
This is not correct. Your mixing the language C# with the .NET Framework, those are not the samet thing.
EKS
Well, what do you do with C# without the .NET Framework? The main point is to provide options for the OP and not nitpick.
rslite
I would not say its nitpicking, but off course provide a answer and provide accurate information is what we are here for. Remember others may find this reply via a search engine, and they may not know the difference between C# and .NET Framework.Also there may options via mono or some other C# framework that does not require installation, that we dont know about.
EKS
The question is rather vague (define "*any* Windows machine"?) and needs some clarification.
Dan
A: 

You need an development environment that can build Win32 applications with no runtime frameworks - or the framework embedded in the exe. So, managed languages are out.

The bulk of native Win32 applications are made in C/C++ using either a Microsoft toolset, or a gcc based product like Code::Blocks or Eclipse.

Chris Becke
+1  A: 

Yes,

If you use c++ you can use more core API's like Win32, but doing this will be alot more work. Atm almost everyone is going to have .NET Framework 2 installed, if i was going to write a portable app i would base it on .NET 2.

I belive there is also apps that are written with .NET 2, that comes with the Framework dll files so it does not require the framework to be installed. I know http://www.nliteos.com used to do this, but im unable to find those versions where they did this.

EKS
+1 for "... almost everyone is going to have .NET 2 ..."
Dan
How can you upvote this when the question specifically disallows .NET?
The question said "... without *installing* .NET ...". "*Any* Windows machine" could be a problem too as that theoretically includes Windows 1.0.
Dan
+1  A: 

As others have suggested, you can do this if you're willing to write in C/C++ with the plain vanilla Win32 API. However, make sure you link statically to the C runtime libraries. Otherwise, your user may have an older version of these libraries and need to install the Visual Studio redistributable to get the same version you compiled against.

Alternatively, use a GCC toolchain like Cygwin or MinGW. With Cygwin you need to distribute cygwin1.dll and license your program under the GPL, but with MinGW you should be able to link dynamically and your program should run on most Windows installations.

Nick Meyer
A: 

Your criteria are "simple application", using a "Java-like" language and "Windows machine". Given that, I think a HTA application would qualify. You can use JavaScript as your programming language and you can do anything that a stand-alone web page can do; some version of Internet Explorer (at least IE4?) is required.

Dan
Huh? What's wrong with a HTA applicaton? (Other than it requires IE...but, hey, this is Windows).
Dan
Another downvote...I wish someone would tell me why they don't think a HTA is an appropriate solution for the problem as it is stated.
Dan