I need to do the internationalization of an existing Java project. I am already using Qt Linguist in a C++ project using Qt and I would like (and have) to keep the same process for my Java project, instead of using the java RessourceBundles.
The help of lupdate specifies that it is possible to use Java files as input, but I have no idea of how to do this. Is it even possible ? Or is this purpose dead with Qt Jambi ?
Thanks,
Roland
Since the Jambi project is discontinued, you will probably not be able to use a current version of Qt Linguist with any Java project. Most features rely heavily on C++ specific language features (e.g. signatures of the translation methods, macros), so without a specific Java port it looks pretty bleak.
TLDR: Most likely: no. You will have use something different for translation (or write in C++ :) ).
Related
Is it possible to compile Java code into a DLL to be used in a Windows Phone 7 application?
I know it's possible to compile Java code into a jar and run IKVM.NET to convert that to a .NET DLL, but can that (.NET) DLL be used in a Windows Phone 7 application?
Thanks!
There may be ways of doing it, but it would be painful - many of the ports of the standard library classes won't be viable within WP7. (Even a lot of existing .NET code won't work under WP7 without tweaking - it depends on what you're trying to do.)
You'd be much better off either finding an existing port of whatever you're trying to use, or porting the Java code yourself. You'll end up with much more idiomatic .NET code that way, too.
No, IKVM is not supported on Windows Phone, and won't be, because it marshals unmanaged code, and emits IL in unsupported ways.
As Jon suggests, rewriting your Java library in C#, while targeting it the phone platform, is a much better idea.
I have a java code and created a jar file.
I need to create an Qt application. Can I use this code in that application?
Please help me how can i use that jar file.
Thanks,
Nagaraju.
You could take a look at the capabilities of GCC/GCJ (see http://gcc.gnu.org/ ). IF it's a good idea is a whole other story, and depends on what you have, and what you're trying to accomplish. It should be doable to link SO's created with GCJ in QT applications, but I seriously wonder if you are not better off using either C++ or Java, but not mixing them
If your Java code takes input from stdin or some file and writes output to stdout or some file, then the easiest way is to fork java to run that jar, and parse the output in your Qt code.
Things other than that, you'll need to be a bit specific. Something like "my Java code does painting the screen".
My advice is to use SWT or Swing.
You can use gcj gcj to compile the java code to library and simply call the functions of the java code from your C code.
Yes, you can use your jar file in your Qt application. I've done exactly this myself.
One way is to use the JNI Invocation API. This is part of the Java Native Interface (JNI), which makes it feasible but not pleasant to access Java APIs from C++.
A much more pleasant approach is to use CodeMesh JunC++ion, which wraps the Java APIs in C++ classes. This is a great product, if you can afford it.
If you have very little Java code, it may be easier to port it to C++.
So... I will have a project which will be tested on Win 7 and some Linux server. It will be a web service that will use HSQLDB, Hibernate, Spring, Blaze DS and Flash (Flex RIA) as front end. I need to implement into it some image filtering\editing functionality which will be implemented in cross-platform C++ code (It will use Open-CV) wrapped in Java.
I need some kind of tutorial how to create cross-platform Java projects that use C/C++ libs *(most of all I am intrested in crossplatform compiling issue and what IDEs support such things)
It sounds like you'll benefit from the Java Native Interface. If you've got existing C and C++ code that you'd like to use from Java you may want to seriously consider something like GlueGen. It will save you a lot of time generating the code to access your C code.
You can have a look at the official Java JNI Examples here
Something along these lines?
http://www.javaworld.com/javatips/jw-javatip17.html?page=1
You're going to need to use JNI. The Java will be totally cross-platform and can be one project. For C++, you will need to create the JNI callable interface, and build as a dynamic library. The code should be pretty cross platform, but the actual build will be different.
On Linux, you need to build as a .so and you will probably use gcc. On Windows, you will probably use Visual Studio and build a .dll. The build will be different.
I'm looking for Java bindings for XLib.
Specially, I need to be able to reparent an X windows application from within Java.
Ideally I would like to do this by making the X windows calls directly from java.
I don't know anything about XLib... but recently I ran across JNA and it seems that it can talk with system APIs so give it a look if you wish:
http://java-native-access.github.io/jna/4.4.0/javadoc/
Good Luck!
I've created xcb (successor of xlib) bindings for Java through SWiG. You can find the code here:
https://github.com/Zubnix/xcb4j
It's a rather large but straightforward implementation and should work once you have all the required xcb module headers installed.
I'm wondering if a Java library can be called from a VB.net application.
(A Google search turns up lots of shady answers, but nothing definitive)
No, you can't. Unless you are willing to use some "J#" libraries (which is not nearly the same as Java) or IKVM which is a Java implementation that runs on top of .NET, but as their documentation says:
IKVM.OpenJDK.ClassLibrary.dll: compiled version of the Java class libraries derived from the OpenJDK class library with some parts filled in with code from GNU Classpath and IcedTea, plus some additional IKVM.NET specific code.
So it's not the real deal.
I am author of jni4net, open source intraprocess bridge between JVM and CLR. It's build on top of JNI and PInvoke. No C/C++ code needed. I hope it will help you.
You can call Java from .NET if you wrap it in some form to make it accessable and the easiest way is typically to use a Runtime bridge like
http://www.jnbridge.com/
Other way is to wrap your API with java webservices.
check this also http://www.devx.com/interop/Article/19945
Nothing out of the box.
Most java/.net interop that I know uses web services.
If you can create COM components with Java, you can use tlbimp to create an interop assembly for using in VB.Net.
If can create standard DLLs that can be used from C++ with Java, you can write P/Invoke declarations and call them from VB.Net.
If you can create a web service with Java, you can generate proxy class from the WSDL and call it from VB.Net.
In any case, chances are the Java component will live in a separate process. I doubt you can load both the Java VM and the CLR in the same process.
If you have the source code and compile it using the J# compiler, then the answer is yes. If you want to call any pre-Java 2 (aka 1.2) libraries, then these are included pretty much verbatim with J#. More recent stuff is going to be tricky though (i.e., it's not there).
An example where this is used commercially are the yFiles graph layout algorithms from yWorks. These were originally just a Java library, but for the past few years they've been offering a .NET version, which is just the Java version compiled with Visual J#.
It's not without problems, and there are some limitations that you can't get around, but it can be done. So... unfortunately this answer looks pretty shady as well.
You could use JNI to instantiate a virtual machine and then use Java Classes. It will be some fun, though, because you would need to use C++ as a bridge between VB.Net and Java.
This article in java world has a quick tutorial on how to use Java from C++ and viceversa.
http://www.javaworld.com/javaworld/javatips/jw-javatip17.html
If you have the source, Visual Studio will let you convert Java code into c#.