I came across open-source project PHP/javaBridge for connecting php application with java. But why should I use java with php? Is there any specific advantage for this? Thanks, Robert
The main benefit is when you already have a lot of existing java libraries that you don't want to recode in PHP, but where you do want to build new applications using PHP
You may want to use a library that is in Java.
You wanna find the right tool for the job, not the right job for the tool. I guess you just shouldn't use it if you have to ask this question.
That said, there are a few good cases where you'll use Java with PHP, most of the times the big advantage is that the Java application keeps running on the background (as a daemon) and it's more powerful.
Do you really need to use Java? If so, go for it. Or are you just looking for new ways to do things? If so, don't bother. PHP is powerful enough to do what you need. So is Java. Pick one, and stick with it...
Related
Good day!
With regards to my previous question about Java Swing being used for web development, I have a job interview today and they told me that their company uses Swing then convert it to javascript then deploy it on the web.
Can anyone explain this to me better? What books / websites should I study so that I could understand how this is done. Is this a good / common practice?
Thank you very much.
You can take a look at CreamTec's AjaxSwing. I've played around with it several times and it's the only product I know so far that takes your existing Swing GUI and converts it into something displayable in your browser.
Whether this is good practice or not is not really easy to answer. This solution works well as long as your application does not need to scale largely. CreamTec states that their solution is suited for about 50 clients IIRC.
The markup generated by AjaxSwing can in no way be called semantic but that is a common thing with these kinds of generators.
You can try AjaxSwing pretty easily since it does not require you to do much configuration but my recommendation is to use a dedicated web framework if you want higher scalability.
It sounds like GWT also. Granted that is not what the person said, but if it was a recruiter, they may been confused on the exact technology.
AjaxSwing is a run-time tool and needs a server license for commercial use.
You might want to try Mia Transformer www.mia-software.com. They change Swing Java code to GWT Java Code and GWT changes it to Javascript and then if you want you can use Google V8 compiler for faster execution. Of course it is not 100%. We are going to try it for a large project and see if it works.
The other link provided to us was http://swingweb.sourceforge.net/swingweb/. Have not checked it out though.
Will keep you posted. If you come across a workable solution please share.
I am considering using GraphicsMagick (http://www.graphicsmagick.org/) in a Java project. Does anyone have any experience with this? Suggestions on how to get started? It seems like there isn't a native Java library so it may be a little more difficult.
Thanks!
We did our project with GraphicsMagick and Java, Q&A here obvious influence our decision. It's a long way but we eventually got it done. We tweaked both GraphicsMagick and im4java very hard to get the performance and reliability we want. Thought I should contribute back:
http://kennethxu.blogspot.com/2013/04/integrate-java-and-graphicsmagick.html
It's definitely possible. Take a look at IM4Java, a Java abstraction around the commandline interfaces of various ImageMagick like tools (including GM) that feels like a language binding. Very little documentation, but sufficiently simple. Obviously your images have to be accessible from the OS (e.g. not inside ResourceBundles).
Currently the only reasonable way to achieve this is by using the command line from Java (runtime.exec). You should use im4java to do this as suggested above. im4java will enable you to build up your "gm command" string using java method calls, it also provides a number of other useful features.
The big advantage of using this technique over actual language bindings is simplicity and reliability. Reliability is important especially if your Java app is running on a Java based server or servlet engine like tomcat. The reason being that a memory fault or other error while using language bindings could bring down the whole Java virtual machine.
I have to integrate a large Java library in a quite large C++ application. A solution is to use JNI but this requires to hand code all the classes. Python has, for example, a wonderful solution with JPype (http://jpype.sourceforge.net/) that automatizes the process (although the same solution cannot be applied to C++ due to C++ and Python different natures).
Thanks,
Das
SWIG is a tool that lets you auto-generate bindings from one language to another. It supports C++ and Java and a dozen other languages.
Seems that my question was not clear enough. Maybe the confusion comes from JNI that allows the access in booth directions ...
What I want to do is to access a Java library FROM C++. That is, someone give me a JAR file that contains a collection od JAVA compiled classes and I must write code in C++ to access it (as I want to integrate the functionality of that Java library into a C++ application).
Hope that this clarifies the direction of access :)
Thanks,
Das
Not sure if this commercial tool makes life any easier, but you might wanna explore -- http://www.teamdev.com/jniwrapper/index.jsf
JNA is not quite what you're looking for, but it does make your life a lot easier. It doesn't require any boilerplate/generated code - you just write an interface for the methods you want to call.
Certainly, there is every reason to use JNA instead of JNI.
I have two suggestions which may or may not work for you:
First, you could try something very simple. Run the Java code in a separate process, and communicate with it with pipes or sockets. This is fairly easy to do, and doesn't require any crazy libraries. The downside is that the communication is somewhat limited (just some simple pipes), you'll need to write your own wrapper around it to send data across
Secondly, what exactly is this library? Perhaps we can suggest alternatives that are not written in Java, that would be much easier to use in your C++ application?
This question already has answers here:
Where can I find a Java to C# converter? [closed]
(9 answers)
Closed 7 years ago.
Is there an effective tool to convert C# code to Java code?
I have never encountered a C#->Java conversion tool. The syntax would be easy enough, but the frameworks are dramatically different. Even if there were a tool, I would strongly advise against it. I have worked on several "migration" projects, and can't say emphatically enough that while conversion seems like a good choice, conversion projects always always always turn in to money pits. It's not a shortcut, what you end up with is code that is not readable, and doesn't take advantage of the target language. speaking from personal experience, assume that a rewrite is the cheaper option.
We have an application that we need to maintain in both C# and Java. Since we actively maintain this product, a one-time port wasn't an option. We investigated Net2Java and the Mainsoft tools, but neither met our requirements (Net2Java for lack of robustness and Mainsoft for cost and lack of source code conversion). We created our own tool called CS2J that runs as part of our nightly build script and does a very effective port of our C# code to Java. Right now it is precisely good enough to translate our application, but would have a long way to go before being considered a comprehensive tool. We've licensed the technology to a few parties with similar needs and we're toying with the idea of releasing it publicly, but our core business just keeps us too busy these days.
This blog post suggests useful results from Tangible.
There is a tool from Microsoft to convert java to C#. For the opposite direction take a look here and here. If this doesn't work out, it should not take too long to convert the source manually because C# and java are very similar,
These guys seem to have a solution for this, but I haven't tried yet. They also have a demo version of the converter.
Although this is an old-ish question, take a look at xmlVM http://www.xmlvm.org/clr2jvm, I'm not sure if it's mature enough yet, although it has been around for several years now. XMLvm was made, I believe, primarily for translating Android Java apps to the iPhone, however, its XML-code-translation-based framework is flexible enough to do other combinations (see the diagrams on the site).
As for a reason to do this conversion, maybe there is a need to 'hijack' some of the highly abundant oss code out there and use it within his/their own [Java] project.
Cheers
Rich
Try to look at Net2Java It seems to me the best option for automatic (or semi-automatic at least) conversion from C# to Java
They don't convert directly, but it allows for interoperability between .NET and J2EE.
http://www.mainsoft.com/products/index.aspx
C# has a few more features than Java. Take delegates for example: Many very simple C# applications use delegates, while the Java folks figures that the observer pattern was sufficient. So, in order for a tool to convert a C# application which uses delegates it would have to translate the structure from using delegates to an implementation of the observer pattern.
Another problem is the fact that C# methods are not virtual by default while Java methods are. Additionally, Java doesn't have a way to make methods non virtual. This creates another problem: an application in C# could leverage non virtual method behavior through polymorphism in a way the does not translate directly to Java.
If you look around you will probably find that there are lots of tools to convert Java to C# since it is a simpler language (please don't flame me I didn't say worse I said simpler); however, you will find very few if any decent tools that convert C# to Java.
I would recommend changing your approach to converting from Java to C# as it will create fewer headaches in the long run. Db4Objects recently released their internal tool which they use to convert Db4o into C# to the public. It is called Sharpen. If you register with their site you can view this link with instructions on how to use Sharpen:
http://developer.db4o.com/Resources/view.aspx/Reference/Sharpen/How_To_Setup_Sharpen
(I've been registered with them for a while and they're good about not spamming)
I'm not sure what you are trying to do by wishing to convert C# to java, but if it is .net interoperability that you need, you might want to check out Mono
This is off the cuff, but isn't that what Grasshopper was for?
Well the syntax is almost the same but they rely on different frameworks so the only way to convert is by getting someone who knows both languages and convert the code :) the answer to your question is no there is no "effective" tool to convert c# to java
Possibly you could use jni4net - opensource bridge instead ?
Or list of other options I know.
Why not write it in Haxe (http://haxe.org/) and convert it to whatever you want it to be?
I'm giving a presentation to a Java User's Group on Groovy and I'm going to be doing some coding during the presentation to show some side-by-side Java/Groovy. I really like the GroovyConsole as it's simple and I can resize the text easily.
I'm wondering if there is anything similar for Java? I know I could just use Eclipse but I'd rather have a smaller app to use without having to customize a view. What's the community got?
Screen shot of GroovyConsole:
DrJava is your best bet. It also has an Eclipse plugin to use the interactions pane like GroovyConsole.
try beanshell. its a scripting wrapper over java. http://www.beanshell.org/
Why not use the GroovyConsole ? Groovy accepts the vast majority of Java syntax
One good reason for not using something like the Groovy Console (wonderful though it is) is when you want to test what something would be like in Java, without actually going to the trouble of a boilerplate class and main method to run snippets of code. There are some differences between what Groovy does and what Java does. It'd be nice to have a simple way to test something and know for sure it will work when you put it in Java.