0

Hi all this is my post on stackoverflow.

I am normally a lurker and find everything I need without posting but was drawing some blanks when trying to picture how this works. Maybe if someone can provide some insight I would greatly appreciate it.

So I understand the software development cycle and know a decent amount about code (c++ and Java, and visual basic, I am a CIS major with a CS minor in my last year). I can write some programs in elipse using Java and I can even make some basic GUI components in eclipse using Java.

Now onto my 3 part question: I understand one could make a .jar from several .java files and distribute it, but while thinking about a common program like say yahoo messenger (just as an example) I came to the following three part question:

First, being could you write a program like yahoo messenger in just eclipse using Java or would you need other tools like other languages and other development environments, how does the project go from start to finish? (I think I am kind of lost here because I have only wrote command line and simple GUI applications).

Second, Say it was easier to create a feature in yahoo messenger using a different language, how can one write one program in more than one language? Say for example you wanted to write some code in python or c++ and your the majority of your code was in Java, ie your main method is java and you are compiling using JVM. (assuming you cant just stick python or c++ code in a java program) I did some Googling around and saw some things about linking the compiler and including native code to include other language code in a Java project. Links to other reading material is acceptable too if the explanation is too long.

Third- How does deployment work? Say I am done writing the code for my program and want to turn it into an .exe (for windows users) and stick it on my site for people to download. I know windows comes built in with an iexpress utility to create .exe's. Besides distributing a .jar how would one go about turning source into an exe? Thanks again for all your input and time. I am a beginner and trying to wrap my head around these concepts. The answers can be provided in a technical realm or just conceptual either is greatly appreciated.

-Mark

Kram
  • 39
  • 1
  • 1
  • 8
  • 3
    This question is impossibly broad. Try asking more specific questions. At least ask separate questions separately. – Stephen C Mar 19 '11 at 09:55
  • I know it is broad and very general. I was just hoping for conceptual answers as in "it is very common for applications to be written in more than one language and there are standard procedures for it. ___ is a link that explains it more in detail. – Kram Mar 19 '11 at 10:22

3 Answers3

0
  1. Several IM clients are written in Java, though I would hazard a guess that the mainstream ones would be mostly written in C, C++ or (on the Mac) Objective-C.
  2. Writing the one program in multiple languages has numerous challenges, and the nature of the challenges varies depending on the combination of languages you want to use. In many cases, you will probably not have much luck combining more than two languages. One set of impedance problems is bad enough, three is an almost guaranteed disaster.
    • You can avoid these problems by splitting a single application across multiple programs, each of which is written in a single language and communicates with the other programs via some kind of IPC mechanism.
  3. Creating an "exe" is also a very language-specific concern. For instance, Java, C#, C/C++, and Python all have radically different deployment stories.
Marcelo Cantos
  • 181,030
  • 38
  • 327
  • 365
  • Marcelo, Thanks for the insight. This helped to clear up some of the questions I had when looking at large scale applications. As far as the "single applications across multiple programs" does that mean like say the chat feature in yahoo messenger being written in c and the avatar stuff being written in say java and them being different programs or parts of yahoo messenger but all still part of the same application. I read the wiki for IPC and understand that there are tools designed to interlace or join parts of applications written in different languages. Thanks. – Kram Mar 19 '11 at 22:25
  • @Kram: Yes, that would be the idea. It hasn't been a common approach until recently, with apps like Google Chrome separating each http domain into its own process (for security and stability reasons, in this case, not language interop). – Marcelo Cantos Mar 20 '11 at 00:44
0

Say I am done writing the code for my program and want to turn it into an .exe (for windows users) and stick it on my site for people to download.

In that case, I'd say you were foolish. ;)

Java Web Start is a better option for deploying a Java based rich client app. from a web site. JWS works for any platform with Java.

Community
  • 1
  • 1
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • Andrew, lol I guess I am slightly foolish. I found a good article on google about the various different ways to deploy java applications either through the web or as executable .jars and those seem to be the preferred methods. I also asked one of my professors and he agreed with your web start method. Thanks. – Kram Mar 19 '11 at 22:28
0

1) I most cases you can write your program in java without needing any other programming language. There are rather rare cases where you need to call a dll from java to interface with some proprietary program, for this you would need to use JNI and C or C++. A perhaps more common case for using multiple languages is for adding scriptability to your application. For example, my company offers a server/client application that is scriptable by users using Groovy, but the server and the rich client itself are written in Java only.

2) The integration of java and another programming language depends on the other language. Integrating Groovy is easy, and I think integrating Python (using JPython) or Ruby (using JRuby) is fairly easy. But it is an effort (not to mention the mental stress of programming in different languages) and I would not recommend doing that unless there's a specific requirement for this.

3) As always, there are several options. See how-can-i-convert-my-java-program-to-an-exe-file for creating a windows executable. Or you can create windows installer using e.g. NSIS. Or use Java Web Start.

If the intent behind this question is getting an idea how some big java rich-client (desktop) applications are written and deployed, I recommend the Eclipse RCP book. This book will walk you through the development and deployment of an XMPP/Jabber messenger client using the Eclipse RCP framework. Be aware though that there is no one true way of creating a big application and other java application frameworks do things differently.

Community
  • 1
  • 1
Jens Theeß
  • 580
  • 1
  • 3
  • 15
  • Jens, Thank you for the clarification. You made some of these topics easier to comprehend. The thread for how to convert java program to exe is very nice. I found a nice article on google about it, but should have looked over the forums for that exact thread before posting on it. NSIS looks like a nice utility to deploy in an exe if I wanted to go that way. I found the book on amazon and have purchased it. Thanks again for the answer to my question. – Kram Mar 19 '11 at 22:55