Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 01, 2007 09:14 AM by PieCook
Oct 25, 2007 05:30 AM|LINK
My classmates and I are trying to create a multiplayer game and host it on a web server. Most of them are familiar with Java, so we decided to write the game in Java. The game engine and UI are almost done, so we just need help with the multiplayer aspect
Now I am tasked with setting the web page that will host the game. We want it to look like
Yahoo! Games or Zone.com, where users will log in, create or join game boards, and when they're all ready, they can start a game. We also want to load a small applet to launch the game.
I want to use ASP.NET and C# for that, since I'm familiar with them. One of our team members, however, was worried that
C# and Java might not be compatible, and suggested that I should learn PHP instead, as he was sure it is compatible with Java. He's not certain, however, whether C# and Java would be compatible or not. Is this true? Or is it possible to launch a Java
applet from an ASP.NET page with C# code?
If so, can I also ask for some guidance, such as links to tutorials or even simple Google queries? I tried searching, but my search queries never lead me to any relevant information. Any advice will be most appreciated.
Thank you very much.
Oct 25, 2007 06:40 AM|LINK
It doesn't matter what framework you choose to develop your pages against - ASP.NET, PHP, Cold Fusion etc. These technologies all run on the web server, and ultimately render html to the user's browser. It is there - within that html in the user's browser
that the java applet will run, and so all you need is html tags to embed the applet. So you see neither ASP.NET nor PHP
need to be "compatible" (whatever you mean by that) with Java (and neither are).
Oct 25, 2007 07:23 AM|LINK
Java Applets on the client side have nothing to do with C# .NET on the server side. They can definitely coexist with one another in perfect harmony complementing each other in a rich way.
However, if you are looking at a Java code on the server side, your best bet is Visual J#: (http://msdn2.microsoft.com/hi-in/vjsharp/default.aspx) However also note that there is a clause
in the webpage entitled "Retirement of J# language and Java Language Conversion Assistant from future versions of Visual Studio", which you may need to significantly read and then decide your serverside language.
Oct 26, 2007 08:59 AM|LINK
Awesome. Thanks for all the info. I think I'll probably stick with ASP.NET and C#, especially that it's got such a nice and helpful community.
Another question, if you please: What will J# look like, or where will it be used? (I've never used it before.) You said it can be used for the code on the server side, so will it be like the ASP.NET and C# that I considered using for the server, but in
Java? If I remember correctly, Microsoft Visual Web Developer only supports C# and VB. If that is the case, are there any other tools/IDE that can run it?
Thank you very much.
Dec 01, 2007 09:14 AM|LINK
After long sleepless nights of research, here are my discoveries on the subject:
Apparently, we have a problem calling the Java application from a .NET environment. An
ASP.NET environment can only run applications written in a native Microsoft language, such as C#, VB, or J#. There are ways to fix that, so we have the following options:
1) Convert the Java program to a Microsoft language, such as C# or VB. This will be an immensely
long and tedious process, so it's almost completely out of question.
2) Use tools to translate Java to C#, such as Microsoft JUMP ( http://www.microsoft.com/presspass/press/2001/jan01/01-25JavaUpgradePR.mspx)
or the Microsoft Java Language Conversion Assistant (http://msdn2.microsoft.com/en-us/vjsharp/aa718346.aspx
). However, the libraries in Java and in .NET do not have a 1:1
mapping, and the usages are quite different. Therefore, it is sometimes advisable to just do the conversion manually. Furthermore, there is currently
no .NET equivalent for many Java APIs, such as the AWT and Swing classes. This means the GUI that we currently have would have to be
re-implemented in a new language and environment.
In addition, Microsoft languages, such as C# and VB, are quite different from Java. The only Microsoft language that is similar to Java is J# (and J++). Unfortunately, J# is based on the
JDK 1.2, so if our application is running on JDK 1.3 or higher (which is likely the case), many parts will not be compatible, and we'd need to write them manually.
3) Download a Java Virtual Machine implemented in .NET, such as
IKVM.NET. Again, AWT and Swing classes are not functional, so this will not help at all.
4) Use a third-party bridging tool, such as the Intrinsyc J-Integra. Unfortunately, this costs
$1500 + $100 per client, so, this rules out this possibility for low-budget students.
I could not find any other ways to solve the problem. My conclusion is that if someone is in the same position, he or she is advised to construct a Java Website using Servlets, for example. I did not do the research on Servlets, but I can safely assume that
Java apps may be launched from that environment without special considerations of .NET/Java interoperability.
yet, I think it *may* be possible to open a Java applet directly using AJAX (although I have no idea how to do it), but that would only work with applets. If we were successful in converting the Java application to a simple applet, it may have been possible
to do accomplish our goal.
Of course, I may be wrong, but that is what I understood by reading all these articles and forums about how to do it. Please correct me if I'm wrong.