Converting a Java Web Application to .Net - java

What is the process involved with converting a Java web application to something like ASP.NET with Silverlight or alike?
I know many Java frameworks have been proted to .Net (either C# or VB.NET), but haven't really seen many web applications done. (I might be very wrong here)
I also know very little about Java programming but know C#, VB.NET and ASP.NET. I haven;t looked at silverlight yet but know what it can do to some extent. I do know though that Java syntax is very similar to that of C, C# and C++ as they all the the "{}" brackets and layed out similarly.
For arguments sake (just to get a handle and example) what would it take to convert something like Alfresco to a .NET type web app? Also, just want to add that I am not planning on doing it but want to know that if its even worth investing time in looking into Java applications to port to .NET.

Microsoft used to distribute a 'Java Language Conversion Wizard' to convert Java code into C# code, including substituting some of the common framework classes. It needs a lot of cleanup after the fact, but may be useful depending on what sort of code you're trying to convert. If you have access to the VS 2005 tools you should be able to install it.
Other than that, it's heavily dependent on how the code's structured. Finding a web framework that's similar to the Java framework used would probably be helpful. In many cases, I suspect it would be easier just to port the database and master page templates/stylesheets across and build the rest from scratch.

This page on MSDN might be useful: http://msdn.microsoft.com/en-us/gg715299.aspx.
It does a conceptual mapping of concepts in Java to concepts in .NET.
Regarding Giacomo's mention of the Java Language Conversion Assistant (JLCA), it is in fact retired and I wouldn't recommend relying too heavily on it. As he says there's quite a bit of cleanup to do but much of that depends on how you architected your app.

Related

can i develop a multiple platform project -windows/Android- entirely with a single cross-platform language?

as i'm still learning, i'm not sure what tools, frameworks, even languages i'm gonna work with..
so i'm working on a simple project that got windows side and android side.. that obviously needs at least 2 languages to get it done, but it's impossible that i can learn those languages and know how to deal with their frameworks to get the job done
so is there a language i can develop the entire project(windows & android) with, and without need to any other language no matter what or how many tools or methods im gonna use to make it work?
-note: i know java is essential for the android side, so that's the point im talking about.... "entirely"
I would recommend you giving a loot at Flutter, it's not like native windows but it can produce applications for Android, iOS and web with a single codebase. It's really intuitive to use and the apps built with it work really well.
You can also take a look at React Native expect you need a Native app that you have to use Java as the core language if not give a trial to this
I notice you've tagged this with C#. To answer your question: that. You can write Android apps in it as well via a library called Xamarin that Microsoft bought out and has integrated into the platform.

Am I able to use JavaScript with the Java SDK?

I want to create a mod for Minecraft, and I am aware it uses Java. I am currently learning JavaScript, and was wondering if I am able to use JavaScript for the SDK.
Yes and no.
Java is not Javascript...but a Java project can interpret Javascript
Java and Javascript are two completely different languages. However, there is a javascript interpreter created in Java, that you can plug in to java, called Rhino. However, although Rhino makes it easier to embed Javascript into your Java code, its not a simple drop in solution that would allow you to simply script what ever you want with out going through the effort of makin the proper connections. Definitely achievable, but you wont likely be able to start scripting without making that time investment to connect Java and Javascript.
Background story
The relationship between Javascript and Java is a rather shallow one. The similar name comes from a marketing plan back when it was being released by Netscape (which most developers ended up moving to the non-profit Mozilla). They made a deal with Sun (bought by Oracle) to share that similar name, but purely for marketing purposes.
Yes, it is possible to run JavaScript within a Java program, using the Rhino Javascript engine (for example).
However, this would not be a good way develop a Minecraft plugin / mod. None of your knowledge of the Javascript APIs would be relevant. Everything you did to interact with Minecraft would entail using Java classes and methods in the Java or Minecraft libraries.
My advice:
If your aim is to avoid learning Java ... don't be lazy. (You'll end up having to learn the Java APIs anyway. And learning another language will be good for you ... assuming you aspire to be a professional programmer.)
If your aim is to integrate some pre-existing Javascript code-base, it might work. But you might be better off porting the Javascript code to Java.
Sorry, Java and JavaScript are totally different languages. The "Java" in both of them was a marketing decision from ancient times.
They do share some of the same syntax that many languages share, however, so if you have learned JavaScript it might be a little easier to get started with Java. They are definitely NOT interchangeable, though.
Have a look at JDK1.6's ScriptEngine, the interface whose methods provide basic scripting functionality. Using these methods you can execute javascript. Numerous examples can be found on usage of this.
script support is avail from jdk 6 onwards:
reference link
However, this is not a full implementation of Rhino.

Starting with Android: Java or Python (SL4A)

I just ordered an Android smartphone and want to start playing around with creating my own applications. Now the question is which language to use, the native Java or Python using SL4A (former ASE).
I tend to Python, as I know it much better than Java, but I'm wondering what I would be missing using a "second class" language on Android. On the SL4A website it is also stated to be alpha quality software, which is not exactly encouraging.
I'm also not quite sure what the limitations of the scripting environment are and if they would be problematic.
At the moment you cannot create a releasable program with Python (or any other scripting language) using SL4A. I have heard rumours that this is something Google is working on, but even if they do enable it Python apps are likely to be slow and power-hungry compared to Java. Also the scripting API only gives you access to a limited subset of the native Java API. I would not consider using SL4A for serious development work at the moment, only for one-off scripts and prototyping.
Take a look at Scala. It is a statically typed language on the JVM, but uses type inference to remove most of the noise that you get in Java. It also fully supports functional programming, and has a lot of pythonish features. Because it is statically typed it is as efficient as straight Java with none of the disadvantages. IMHO it is the language that Java should have been in the first place.
A lot of people are blogging about using Scala on Android, so Google around for more information.
More likely will depend what type of applications you will develop.
I would start with Java to become familiar with Android SDK. Anyway first you need to look into some examples, tutorials. Most of them are done in Java, and only a few, probably on the dev site of SL4A for that.
Also there is native development Android NDK, that can be programmed with C++.
But anyway Java rules for general applications.
Adding an update to Dave Kirby's answer:
Issue 55, Distribute scripts as APKs, in the issue tracker at SL4A deals specifically with that.
There is a solution being worked out (may be complete by now) described at SharingScripts. The only issue seems to be that you need to have a interpreter APK already installed.
you may want to check out Ruboto it is a framework for developing Android apps based on JRuby which means your JRuby code can call Android APIs and can also be called back from the Android Java side.
Here is an introduction article .
Consider ising Kivy, if you want to write Android apps with Python. The process of packing script to .apk file is described here.
The problem is, resulting .apk will be big (~7Mb for 300Kb data). It is obvious, because you need to pack there Python runtime and all libraries.
Another solution I have heard of, is Pygame for Android, but it works on lower lewel, so you need to draw graphics manually.
Unfortunately, I have not tried any of this ways yet, but it looks, that I'm going to start using kivy soon.

Is php very limited?

I've tried asp.net and jsp...and the programming language was powerful enough to create both desktop and Windows apps.
Butwhat can I possibly do with php other than creating web applications? Does it have some kind of runtime or framework?
Thanks
Powerful is an unfortunate word. It's about focus, not power. PHP is not very well suited for desktop applications. In part because of weak library support (Though some exists), and in part because of its memory management model. It can be used for jobs outside the web world though; It's often used as a general scripting language, as well as various background tasks.
PHP is not "limited" per se. PHP is primarily only used to develop Web applications. However, there are products like WinBinder that promise to allow you to use PHP to build a desktop application; I wouldn't exactly recommend that though. Also, you probably have not built Windows applications with ASP.NET and JSP but rather more likely .NET WinForms and Java (perhaps Swing). PHP is used by thousands of developers building many different Web applications. It is possible to build other kinds of applications with it but again I wouldn't recommend going down that path.
PHP was intended as a web development language, but you can write console scripts with it, and if you're feeling brave, use something like PHP-GTK to write GUI apps.
PHP makes a surprisingly good shell scripting tool. It has a wealth of simple functions built in.
File IO
String manipulation
Array manipulation
While you can do the same thing in JSP and C# you will spend a lot more time vs. any scripting langauge.
The biggest advantage PHP has over other scripting languages is PHP.net Documentation. Out of any language I have ever used this single resource defines what good documentation and organization of a langauge reference should be.
PHP can be run via an interpreter on the command line, so any computation task can be done in PHP. I don't know about desktop apps and GUI.
PHP has a runtime but it's not fully interpreted like some languages. For example, you can't redefine a method. As far as desktop apps, PHP has bindings for creating desktop apps but it's not very good. It's great for command line tools. Zend and CakePHP are two frameworks for web apps. PHP is like a very-easy to use version of C with a very good community of extensions (look at the extensions on php.net docs). PHP is well supported on windows (even by Msft).
Quite often it is the "limitation" or for want of a better word "focus" of a language that makes it powerful rather than weak.
I'd say PHP is best suited for web application development.
It does the job, and does it well.
But that's not to say that it is not useful for anything else. It can be used as a generic scripting language.
With Qt, you can even develop desktop apps using PHP. Check out http://php-qt.org/
But the focus must be with web apps: PHP was intended for the web.
Depends on what you consider powerful?
It is designed for server-side web-development, and it does that perfectly.
I can't see myself saying one language is more powerful than the other, as it is always a matter of preference, the task at hand and whether the language was designed for what you are trying to accomplish.

Webservices - Java or .NET?

I need to implement webservices in an upcoming project and wanted to know what are the main points to base the decision on whether to implement using java or .NET
I'm a C++er...
If you're a Java shop use Java. If you're a .NET shop use .NET.
There really is no difference that makes one of the two languages superior to the other in regards to web services.
Possible consideration - .NET pre 3.5 only provided support for SOAP based services, but I believe the 3.5 WCF offers REST and SOAP now.
There's no real difference from programmer's point of view (implementation).
For me, a reason to pick Java is that all tools and infrastructure are free/open source. OS, deployment web server, databases, IDEs and developer tools.
I have plenty of experience with both, and both will certainly do the job.
However I tend to prefer Java over .Net for things like web services for the following reasons:
It's cross-platform, which gives you much better options on the hosting side (e.g. running a big Linux cluster on Amazon EC2)
The library ecosystem is larger and more mature, especially on the server side.
I prefer the more flexible open source philosophy to "the only way is Microsoft". Vendor lock-in is always a bad idea for your enterprise architecture in the long run.
You can optionally use awesome languages like Clojure or Scala on the JVM
Ultimately though, I'd go with the one your team has the most skills with. This will determine what you are most productive with, which is usually most important if your main objective is to deliver value quickly.
It's a personal decision, usually determined by the technology already in place or the skill set of the developer(s) writing the services.
i've never really developed web services in java, but i have in .NET and if you're using Visual Studio they're an absolute cinch to whip up (i expect they're a little more difficult to do without the aid of VS).
if you're already working in java, and don't have any .NET stuff in place, stick with java - it'll save you a lot of money (if you were to get Visual Studio in, as i mentioned), and possibly some time involved in learning the specifics of .NET
In my experience, Web Services are a bit more tightly integrated into Visual Studio than they are into Java's editors.
The Eclipse IDE doesn't even have JAX-WS (Java standard web services stack) support built in, opting to use Apache Axis 1 instead.
Netbeans supports JAX-WS, though.
I personally prefer .NET to Java for many reasons I don't want to go through, since it doesn't really matter and is more a personal preference than a strict guideline I can recommend.
If you have Java infrastructure in place or using a platform other than Windows for your server applications, I strongly suggest Java. However, if you don't have anything in place and running on Windows platform, .NET is pretty cool in that area (WCF/ASMX/WSE/...).
As you say you're a C++ - er you'll probably find .NET easier as you can target it directly from C++.
I'm a Java guy, but I think Web Services are easier to code in .NET. Visual Studio takes care of everything, in Java it takes a bit to get started.
A bit of a problem in some projects with JAX-WS is, that SUN ships the "old" version 2.0 with Java 6. If you want to use the current version, it's some work to make it run with Java 5 and Java 6.
If your app must be portable, you should obviously choose Java. Otherwise I would say it's just a choice of your preferred language, since the above issues are really small (maybe you want to choose Axis or something else anyway, I haven't worked with something other than JAX-WS yet).
IMO if you want to do SOAP, then its a heck of a lot easier to use .NET and WCF. However, I've found REST to be a bit tricky with WCF, and had to implement a custom XML parser to do it instead of using their built-in one.
You probably want to consider your hosting environment too. If you are going to serve this from Windows hardware, you can drop .NET WCF web services into IIS. If you are going to run a Linux/Solaris server, then it isn't even a question...
I suggest implementation with JSP ,it provides a robust platform for development
I prefer JSP to ASP or any microsoft techonolgy!

Categories