Home > Mono > Introduction to Mono – Your first Mono app Introduction to Mono – Your first Mono app Eugenia Loli 2005-02-08 Mono 46 Comments The first in a series of articles about Mono. This article explains how to install Mono and shows how to compile your first Cross Platform application. About The Author Eugenia Loli Ex-programmer, ex-editor in chief at OSNews.com, now a visual artist/filmmaker. Follow me on Twitter @EugeniaLoli 46 Comments 2005-02-08 7:01 am Anonymous He even gives detailed instructions on the complicated bootstrap process. Mono gtk# or Mono Winforms (soon) will give crossplatform developers a nice framework without restrictive licenses that other toolkits impose on you. 2005-02-08 7:45 am Anonymous There is even OSX build! Cocoa is too much for a switcher from Windows like me, and it will be much easier to port programs or switch to OSX development. 2005-02-08 9:52 am Anonymous Although I like th idea of mono, IMO the install is too hard! Just look at what that guy had to do to get his mono working — without GTK#!! I’ve tried this before on my Slackware10 box at home, and eventually gave up because it felt like I was istalling half the known universe from source just to get mono capable of building GUIS!! Would be nice to see a simpler build process, or maybe some packages for non-rpm distros. Cheers! –Rob 2005-02-08 11:08 am Anonymous but then couldn’t repeat the experience ever since yes it is hard anything gnome is hard but then anything kde is hard but then anything linux .. 🙂 2005-02-08 12:09 pm Anonymous When is Windows.Forms expected to be available? BTW, does anyone know if IronPython is still being actively developed since the guy doing it went to Microsoft? The website has not been updated for a long time now. IronPython looks very nice, I hope he won’t quit it. 2005-02-08 12:12 pm Anonymous I don’t think it’ll come any easier than: ./configure make make install It even says so in the README file in mono-1.0.5.tar.gz tarball. It furthermore says that Mono requires pkg-config and glib-2.0. I was rather amused that he didn’t have gcc installed when he afterall was about to try to compile something. He got over it using Yast. Good for him but why didn’t he used Yast to install bison, pkg-config and glib. He would’ve gotten over depencies a lot easier that way. By looking at the authors website (link via codeproject) he’s very into .NET developing on Windows and that stuff. Not that that’s bad and attempting to compile Mono from source was a rather bold move from one who obviously is on deep waters when on his linux box. He succeded his compile but at the cost of showing that he’s got no clue of what he’s doing and doing so shows that compiling under linux is hard. It’s actually not that hard to compile something under linux when you know your tools. Knowing your tools is another problem as it also is under any other OS. 2005-02-08 12:19 pm Anonymous It’s only hard if you build it manually and that should be expected. 2005-02-08 12:25 pm Anonymous “Mono gtk# or Mono Winforms (soon) will give crossplatform developers a nice framework without restrictive licenses that other toolkits impose on you.” wich other toolkits? gtk has been available from almost anything, from c and c++ to high level languages like ruby and python and to alternative ones like AliceML, for years. What is gtk# bringing to the table, apart from personal liking of the C# language? Not to mention that now that Qt is going to be opened, and that wx, and fox have been available in all platforms with many language bindings for a lot of the time, and mono will still miss ’em for a while. 2005-02-08 12:50 pm Anonymous It is pretty stupid and misleading. He should have installed glib-devel package. 2005-02-08 12:57 pm Anonymous What is gtk# bringing to the table, apart from personal liking of the C# language? Like he said, a nice framework. Obviously “nice” is always relative and it makes no sense to argue about that (some might prefer PyGtk, others GtkMM). Notice that the GPL, while being totally free, is still a rather restrictive license, especially in the case of libraries. So if you are looking for a nice cross platform open source development framework with non-restrictive licensing (allowing you to use whatever license you want without paying royalties), then Mono is clearly a nice option. 2005-02-08 1:22 pm Anonymous I think your real question not lies why use Mono but why use C#. Mono is not a language, but an implementation of the .NET framework based in the C# language. Whether it’s easier to code in Java or in C# is a subjective matter. For some it’s easier for others it’s not. Some might even claim that <insert an obscure language here> is easier 😀 2005-02-08 1:56 pm Anonymous So then… do you think it would be possible to implement C# to Java? 😉 I use Jython whenever I can. Using the Java libs with Python is really a great thing. Sad it is a bit forgotten today… ACH! From now, let’s make a new naming convention: “Java” is the language; “.Java” is the platform. Catch the dot wave! 🙂 2005-02-08 2:18 pm Anonymous why use mono when java is there? One word: integration. Gtk# apps look like GTK+ apps which look like all your other apps when you’re on Gnome. Java Swing apps look like Java Swing apps, and if you use the GTK+ Look-and-Feel, they look like Ass. Well, they do on my box anyway, and I’m using the Mist theme engine. Things look better with Bluecurve, but still not perfect. Of course, you could use the Java-Gnome bindings, but it seems that nobody uses them. (I’m sure many will correct me, but I don’t have any Java-Gnome programs installed…) SWT is another option, but I only have one program that uses it, Eclipse. java is more used, majority of the time is faster… I beg to differ. How many widely-used Java programs do you know of/use on the Desktop? Not Server-side software such as JSP or J2EE, but on the Desktop. I’m not aware of many widely known Java programs — IDEs such as Eclipse are all that come to my (admitedly biased) mind. Compare this to C#/Gtk#/Mono, with Beagle, Dashboard, Muine, MonoDevelop, MonoDoc, and Blam! I only use two of them, but I’ve heard of them, and many are frequently mentioned on osnews. Again, I’m biased — I’m a Mono developer — but Desktop Java programs just haven’t penetrated my skull the same way that Gtk# programs have. it’s easier to program with java… I’ve written Gtk# programs, and I’ve written Java/Swing programs (I actually maintain a Java/Swing program, which is why I know it looks like Ass with the GTK+ Look-and-feel!). I personally do not find Java to be any easier than C#. In fact, I find the opposite — C# is a much more expressive language, and I keep wanting language features C# provides or will provide, such as properties, events, and delegates. (Yes, I can always squint at my Java methods and say “these methods make a property,” but it’s still not as nice as C# properties; it’s especially weird how the casing keeps getting changed when viewing properties in an IDE: i have getSomeProperty, but the IDE lists it as someProperty (not the changed case of ‘S’. C# events are much nicer.) Then there’s the GUI libraries, Swing and Gtk#. I miss Glade in Swing, or a Glade-like mechanism, much as Eugenia may hate Glade. It certainly beats manually laying out a window. Of course I could use NetBeans to construct my GUI, but I found it difficult to learn (probably because I didn’t spend enough time with it), and I couldn’t make it generate the layout I wanted. Once past GUI construction, I found the two comparable. 2005-02-08 2:21 pm Anonymous .WAVE (TM) 2005-02-08 2:24 pm Anonymous Very easy question to answer Java is dead on windows and .NET will be integrated into every windows system on the planet. Plus the CLR is a objectively better runtime than the JVM and C# is subjectively a better Java language. 2005-02-08 3:03 pm Anonymous Compare this to C#/Gtk#/Mono, with Beagle, Dashboard, Muine, MonoDevelop, MonoDoc, and Blam! I only use two of them, but I’ve heard of them, and many are frequently mentioned on osnews. Beagle isn’t ready for prime time. MonoDevelop, and MonoDoc are of interest only to developers. If you were talking about developer apps, there are tons out there that are written in Java. From the IDEs (Netbeans, Eclipse, IDEA, etc) to installers(izpack) to modeling tools (PoseidonUML and gang). I use Netbeans and Eclipse regularly, and occasionally izpack to create crossplatform installers for my apps. Only BLAM! and Muine are Mono apps that the average user will come in contact with. For Java, if you’re into the whole P2P thing there’s Azereus and Limewire. If you’re busy writing academic papers, there’s JabRef that you’ll find useful but I use BibDesk since I’m on OS X :-). If you do mathematical modelling and use MATLAB, well, the whole GUI of MATLAB 6.5 and 7 is written in Java, for better or for worse(though usually worse if you talk to MATLAB veterans). Mono is great and I’m looking forward to the integration of Beagle into Gnome. But to say that Mono has more apps than Java is just misleading. 2005-02-08 3:10 pm Anonymous Code reuse. I code in Java, Php, and C# depending on the project or the target platform. I have written some nice objects in C# that would be nice to port to Linux without having to re-write them in Java or whatever language of the day. By the way for Java development use NetBeans or Eclipse. Netbeans takes a little getting used to, but I use that more than any other IDE. 2005-02-08 3:12 pm Anonymous Installing Mono isn’t hard. Just use Debian Sid or any other distro where you can simply install it from binary packages…: http://pkg-mono.alioth.debian.org/ 2005-02-08 3:16 pm Anonymous My question is: Why should I care about Mono, C# and .NET? First of all, Microsoft owns the standard and the patents — they could wipe out Mono any second. Second, Java is a good enough cross-platform standard if you want bytecode that’ll work everywhere, but isn’t fast enough to do much. Third, it’s Microsoft and Windows centric. I haven’t seen a good API from Microsoft yet. (Then again, I’m picky.) It should be an open standard, methinks. And fourth, and this is just an opinion, C# is pretty damn ugly. 2005-02-08 3:26 pm Anonymous Yeah, but Mono is still a young project while Java is already relatively old and well known everywhere. Naturally there are not that many Mono apps – yet – but you can rest assured, they are coming as the interest in Mono is growing rapidly. As to IDEs and languages, I’d rather promote something that uses Python, Ruby, PHP and other modern and high level dynamic languages (that also tend to be much, much more intuitive and easier to learn to newbies etc.). But if I had to choose between C, C++, Java or Mono (C#) and related tools, it would clearly be Mono, Monodevelop and C# for me. The real problem with Mono is the FUD factor related to some MS .NET patents/IP (ASP.NET, ADO.NET etc.). Even if there was no real threat(?), lots of people just shy away from Mono because MS and software patents have at least a little role in the game. 2005-02-08 3:57 pm Anonymous Why care? Because Mono provides the free software / open source software community with good development tools? C# more ugly than Java? Java was supposed to improve C++ ideas while C#, on the other hand, is a sort of improvement over Java’s shortcomings. So me thinks the syntax of all those C related languages looks the same, i.e. as ugly, including Java… Microsoft owns the standard and the patents — they could wipe out Mono any second. Not really true (though there could be some problems). Read the Mono FAQ about licenses and patents here: http://www.mono-project.com/about/licensing.html Mono implements the ECMA/ISO covered parts of .NET, those are relatively open standards, also when compared to Sun’s Java. As to patented .NET technologies (from the FAQ): The Mono strategy for dealing with these (patented/problematic) technologies is as follows: (1) work around the patent by using a different implementation technique that retains the API, but changes the mechanism; if that is not possible, we would (2) remove the pieces of code that were covered by those patents, and also (3) find prior art that would render the patent useless. 2005-02-08 4:35 pm Anonymous Before i was flaming mono project. now i do not bother, becuase i know they have a lot of road to go until challenging these facts.. when they are there, maybe i can check it out. But you’re anger over the complete ineptitude of Java to even make a dent in anything except the COBOL of the 21st century market compelled you to show your bitterness:) Don’t worry, there will many more .NET and Mono articles for you to be angry over:) 2005-02-08 5:19 pm Anonymous IMO, there won’t be actual problems regarding .NET patents and MONO. Microsoft rarely used patents, AFAIK, to beat competition. I remember many MS officials excluding in many interviews. MS is proud that always won because of market success, not patent threaths. One can then argue that MS also used unlawful ways to achieve that (as anti-trust decisions around the World proved) but I can’t recall MS waging *starting* legal wars against competitors. I only remember about minor things like domain names claims and so on. So I don’t think there will be any patent problem about MONO, expecially now that Novell got involved. As a theory, Novell could be able to license that technology (and then provide such framework as a free added-value for its distros) and so there’s nothing to worry about it. Since Novell is actually investing money in such technology by developing many internal projects using MONO, they cannot afford to loose it. Plus, if MONO will be successful (as I think it will be), Novell could have an added-value which could sell their platform. An advantage over other distros. Plus, if I remember well, Novell and MS still have to settle a long-time legal thing about Wordperfect so that could be a good thing to trade for MONO. However, it’s very unlikely that MS could ever sue anyone about MONO. They don’t do such things. Companies usually do that to MS (right or wrong) and most companies only try to get big money from that or (like SUN) to defend their strategies. But, talking about Sun, isn’t MONO something every similar to MS Java? 😉 I wonder if people who yelled and cried about MS Java would do that against MONO too. However, I personally saw a few references to MONO on various MSDN articles and that means Microsoft accepted MONO otherwise they wouldn’t allow such references on their pages. 2005-02-08 5:26 pm Anonymous Of course, you could use the Java-Gnome bindings, but it seems that nobody uses them. (I’m sure many will correct me, but I don’t have any Java-Gnome programs installed…) Java-Gnome is starting to gain momentum now, that’s why there aren’t many JG apps yet. Basically, most of the ppl still don’t even know JG exists. But that’s starting to change as the JG bindings have improved a lot in the past months. Anyway, here are some screenshots of some JG apps developed: http://java-gnome.sourceforge.net/cgi-bin/bin/view/Main/ScreenShots They’re few i know, but like i said, JG is just now gaining momentum. Victor. 2005-02-08 5:51 pm Anonymous still, apart from fanboy slogans, can mono adress “any” superiority over the terms i said? no.. java may not be perfect, but still is a better choice for me. 2005-02-08 5:52 pm Anonymous Mono’s implementation is much better than Microsoft’s simply because Mono makes a much bigger effort to be cross platform. Microsoft should give their customers more options like this so they can use Linux in place of Server 2003 really 2005-02-08 5:55 pm Anonymous I think C# should not be used as the main language binding for GTK. C# and the CLR is pure Microsoft specific. Look at the .exe files: They contain MS-DOS code! The core library is called mscorlib.dll. IMHO Linux should not include technology from competition. The same as VW would never build in a BMW engine in their cars. If they do, they would be depending on the competiton. That’s stupid. BTW: I use both: Windows and Linux 2005-02-08 6:39 pm Anonymous Mono’s implementation on OS X leaves much to be desired. The installer provided on the web page doesn’t come with Gtk# for OS X. Gtk# is only available on OS X via fink, assuming you can get it to compile. Even then, it’s limited to using X11 which doesn’t look terribly nice on OS X. Wish they would come up with a Cocoa port of Gtk#. When they do, I’ll be all over Mono like … let’s not go there :-). 2005-02-08 7:57 pm Anonymous You have a poor attitude and your logic is seriously skewed. Mono takes the best that MS has ever created (.NET) and have made it available to the OSS crowd…it’s brilliant. Why should everyone go without it because you feel that the letters “ms” somehow taint the open source world? Ignorance. 2005-02-08 8:10 pm Anonymous All this patent stuff is interesting. However I don’t think this how Microsoft will play this. They have Mono playing perpetual “catch-up”. This means developers have no time to innovate but just rip from Mac-OSX or Windows. The problem isn’t who created or patented it. The problem is who will be the first to innovate, who controls the future direction. And in this case that company is one to be feared and respected. The funny thing is all the GNOME people who complain about Trolltech and then at the same time talk about how Mono is the best thing since slice bread. Personally I’m not touching Mono ever. But at the very least the stuff will work on GNOME anyway, but cross-platform. Dream on. 2005-02-08 9:40 pm Anonymous The people saying that there is no Java on the desktop have clearly never used Azureus [azureus.sourceforge.net]… 2005-02-09 7:02 am Anonymous Microsoft won’t shut down mono for this reason; it creates a community, a community where by mind share can develop and as a result, end up with a even larger community of C# developers ready to write code for their new gee-wizz Office suite, which will be connected to everything under the sun (no pun intended). With this community, new extensions, libraries and enhancements ontop of the framework will develop, which will spur adoption of Microsoft orientated products and services. Even if *EVERY* server converted to ASP.NET on Linux, developers would still be running Windows with Microsofts IDE, because the simple fact, every IDE created so far by the OSS community sucks; Glade is a usability nightmare, and as for Glade#, the explaination on how to use it with C# almost bought me to tears. OSS coders, get this through your head, C# developers will be those in organisations needing a quick and dirty solution; draw a button, double click, add code and compile. Sorry, not even *ONE* OSS IDE comes close to something like that. 2005-02-09 10:19 am Anonymous OSS coders, get this through your head, C# developers will be those in organisations needing a quick and dirty solution; draw a button, double click, add code and compile. Sorry, not even *ONE* OSS IDE comes close to something like that SharpDevelop does that. There’s no reason why that functionality can’t be added to MonoDevelop. 2005-02-09 12:34 pm Anonymous Sun makes it a PITA to deploy or even retrive. Sun’s whole web site makes getting anything from Sun a whole lot of trouble. 2005-02-09 12:40 pm Anonymous For some good reasons (speed, beauty), there is not too many standard software written in Java. Java is often used for inhouse development or projects with a limited number of users; in this scenario, the speed of development, the connectivity and the number of available libs matter. BTW: Two java progs worth mentioning The Oracle installer; and the Aqua Data Studio, a nice database frontend for developers. 2005-02-09 12:58 pm Anonymous It would be a very, very stupid move of MS if they tried to kill Mono. First of all, C# and .net do hardly have any new features you can’t find prior art for. But even trying so would signal to decision makers: Use .net and you will be locked to Windows for all times. MS make .net and C# an ECMA standard to avoid this impression. Anyway, Mono is no threat for MS. C#, .net and Mono are positioned against Java, which already _is_ cross plattform. There will be many .net programs which also run on Mono but you can bet your **** that some .net programs will not. Those people who are already locked to Windows will not be released by Mono. And as long VS.net is the best IDE for .net, .net developers will be attracted to the Windows plattform, while java developers can use Linux as well. 2005-02-09 2:05 pm Anonymous According to Miguel ( http://www.mono-project.com/about/faq.html#msft ) even if Microsoft changes the spec / introduces undocumented features in .NET Mono would still be a powerful platform . There are aspects of Mono that are not part of .NET – The GTK stuff for example. As far as cross platform goes, the article mentions you can test it by copying the compiled “hello world” application from Linux/Windows to Windows/Linux and running it. That’s only a simple example though. E. 2005-02-09 2:08 pm Anonymous IMO Mono is not too much focused on offering a runtime platform for MS .net progs. 2005-02-09 2:37 pm Anonymous <paste> As far as cross platform goes, the article mentions you can test it by copying the compiled “hello world” application from Linux/Windows to Windows/Linux and running it. That’s only a simple example though. </paste> Yes, I’ve seen the Novell Brainshare demo. It works, for now. All Microsoft has to do to keep some very smart developers occupied is change .Net so Mono has to reverse-engineer the changes and thereby Microsoft can control manpower available to one of the major Linux DE’s. Microsoft is alot of things but they are not your friend, and they are not to be underestimated. Unforuntately they are also not stupid, what they lack in technically talent they have in lawyers, marketing depts and the business end. That is why I say cross-platform long-term is at best questionable. Mono is cross-platform as long as Microsoft wants it to be cross-platform. After all, they control .Net. It is *their* product, *they* direct it. Funny thing is I thought Miguel et al started GNOME because of a worry of a corporate controlled desktop yet it appears that is exactly what they are creating. Luckily Havoc, Seth et al are around so I don’t have to worry to much about alot of Mono penetration to my DE of choice (well, basically because I started with it to be honest… 1.2 back in the day.. ) 2005-02-09 3:10 pm Anonymous Unforuntately they are also not stupid, what they lack in technically talent they have in lawyers, marketing depts and the business end. Uhhh… If we’re discussing about .NET and if people wants to clone it, maybe it’s because MS doesn’t lack tech talent. Let’s be serious. MS is an highly innovative company and, while they messed up with some legal aspects, they still remain an highly innovative company, probably the best one. Proof is their products could not resist an attack from *free* competitive products if they weren’t more innovative than competition. No commercial company could ever resist such attacks by legal or marketing means. The real truth is competition (in the form of Linux) is not that innovative as many think. Proof is that when someone actually delivers something innovative (like Solaris 10, in my opinion), even people who prefer MS like myself turn an hear to listen what others have to offer. Instead I agree that, when you have standstill in features, they’re the best at marketing their ideas, partly beause they’re smart, partly because they have money and power to do that. 2005-02-09 3:17 pm Anonymous Don’t fool yourself. People keep using Windows because they are invested in Windows. Linux is probably better and cheaper, but it doesn’t run the _same_ stack of software they paid thousands of dollars (or euros) for. 2005-02-09 7:34 pm Anonymous Heh. I don’t know if you believe half the manure you just spoke but hey if you do. Microsoft made it because they were the cheapest option. Ran on cheaper hardware, software was cheaper, etc. Nobody runs Windows because they actually want to. Trust me, I’ve been in tech support for a few years and people equate Windows with computers and assume all are spyware, adware, crash-prone etc. If they used anything else there would be a realization through knowledge that windows does not equal computers but just windows itself. Although making people learn isn’t easy. However since most don’t run their own boxes, they get their “Computer friend” to do it, and the OS comes pre-installed, it isn’t likely that this situation is going to change overnight. That being said, I left Windows for Linux, I know a few other people who have, and more that are thinking about it. And although ever year is the year of the “Linux Desktop” progress comes slowly. You can’t change a society overnight, and Microsoft is firmly entrenched in society right now. Show me one Microsoft innovation. They innovate as much as Gnome does, which means ripping off of everybody else whether it be Mac OSX, KDE, etc. KDE rips off everybody too but in KDE’s case I think it has more to do with what people are used to and therefore will recreate rather then a concious “Let’s Rip!”. That being said I run GNOME. Heh. Microsoft is alot of things, innovative however it is not. They _were_ the cheapest game in town. They’ve lost that advantage. The next 5-10 years will be fascinating. I’m very open-minded to new technologies but I think the phrase goes “Fool me once, shame on you. Fool me twice shame on me”. How about dozens upon dozens of times Microsoft has proven how it can win only with dirty tactics and lock-ins? Suit yourself, but personally, I also believe in learning from the mistakes of others. 2005-02-09 8:36 pm Anonymous I run Windows because I want to. Your entire argument is a fallacy. Succumb to me now. 2005-02-09 9:12 pm Anonymous Don’t fool yourself. People keep using Windows because they are invested in Windows. Linux is probably better and cheaper, but it doesn’t run the _same_ stack of software they paid thousands of dollars (or euros) for. That’s another myth. Availability of Windows versions of free software is blatantly uncovering that such arguments are just allegations. I’ve personally seen *many* people who preferred to use a pirated copy of MS Office instead of a free copy of OpenOffice. One might say that they’re accustomed to Office but that’s not the whole explanation. And the list could go on. That doesn’t mean that there aren’t *very good* free softwares, of course. And please, let’s stop the weak argument (and this is to Jeremy) of ripping off ideas and blah blah blah. Evolution and innovation *always* come from elaboration of knowledge, which sometimes also means just integrate things which already exist but no-one thought to integrate. This is not referred to Microsoft but the whole mankind. Every innovation or discover always comes from elaboration of knowledge. No-one is accusing Stephen Hawkings about ripping-off Einstein ideas… we call that research. This is a very weak point and poor argument. However, this was about MONO so I guess we’re getting out of the scope 😉 2005-02-09 9:28 pm Anonymous I would just like to say that I think what Mono was trying to do could be done in Python with wxPython. Though, I much prefer python to C# and Java, so I am biased. Westminster High School Football Rules! 2005-02-10 3:54 pm Anonymous The guy is obviously aiming this at windows developers who don’t know all that much about Linux and linux tools.