Is there any equivalent in Java to swf? - java

I am looking to create swf from Java, like ming from C/C++.
Is there anything like this for Java?

JavaFX was actualy created for these purposes.

TransformSWF from Flagstone Software is a SWF-generating library for Java.
It supports through Flash 7, is under reasonably active development, and has pretty good docs on its home page. BSD licensed.
Its sister TranslateSWF is meant for compiling AS1 into SWF-embeddable bytecode from Java.

maybe OpenLaszlo? not from java, but using java at least

JavaSWF - Macromedia Flash File Format
JavaSWF provides a pure Java wrapper for the Macromedia Flash file format (known as SWF). It enables the parsing and generation of Flash content within Java applications and servlets.

You could always use SWIG to generate a JNI wrapper for Ming.

Related

From JS to Java?

I know GWT beeing able to code in Java and translate the cope on compilation to JS.
What about the other way around? Is there something that can translate JS to Java code?
You may want to take a look at Rhino.
From their site:
Rhino is an open-source implementation of JavaScript written entirely in Java. It is typically embedded into Java applications to provide scripting to end users. It is embedded in J2SE 6 as the default Java scripting engine.
Aside from Rhino (by Mozilla) there is also Nashorn (by Oracle) (which btw. means "Rhino" in German), which is an official JS implementation in Java.
It will be available OpenSource with Java8 in 2013.

Blackberry Java runtime missing a bit?

From what I understand, Blackberry Java Runtime runs micro-java runtime.
Which is based on Java 1.3. (thanks Andreas_D)
Blackberry supplies a few alternatives, or the micro-java supplies some alternatives.
But its such a pain. We have an App that uses android java, of which supports full Java 1.6. We were hoping for a conversion of the UI components, but now have to rewrite code?
Is there an easy way to over come this problem?
I cant get a java.io.File for example. And its not the only one..
Are there alternatives for :
java.io.RandomAccessFile
java.io.File
java.io.FileOutputStream
Missing a bit? Yes if you're comparing it to a full Java SE / EE implementation. No if you're comparing it against the Java ME reference implementation.
Java ME (J2ME) doesn't contain all the API classes you may expect in a full Java SE platform - it was never intended to. Also, mobile devices need to be able to grant and revoke specific permissions to applications etc.
Remember it's a deliberate subset for devices with limited resources and the omissions are pretty well documented. For example, file access in Java ME is done via file connection api:
File Connection API
Also see these sites (for other/general differences):
Differences between Java SE, EE and ME
Difference between Android and Java ME development
Differences between programming for a J2ME JVM, and programming for a J2SE JVM
Java ME Wikipedia Page
Java ME CLDC - Noteworthy limitations list at Wikipedia
Blackberry supports Java 1.3, not 1.4.
The cleanest way to get around those missing File-related classes would be to write some wrapper classes which just expose the functionality you need, then you can write implementations for BlackBerry using whatever's available via the J2ME and BlackBerry APIs.
Alternatively, you could just write your own versions of java.io.File etc for BlackBerry, and include those in your project. If you take this approach you'll need to be very careful to mimic the behaviour exactly or you could be opening yourself up to a whole new world of painful bugs.
There may well be libraries out there for BlackBerry which do what you want, I'll leave it up to you to do some googling on that...

Convert Java jar file in to cpp

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++.

Is there any language other than Java that will work as ubiquitous on mobile?

I'm trying to write a rogue-like game for my blackberry and hopefully
any other phone that supports some sort of JVM.
Because I use Java in my job I'm looking to write the game in another language but I cannot find a language that will work on multiple phones.
Am I stuck with Java?
If you're programming for Android, you could for example use Scala, see Scala on Android. Scala compiles to Java bytecode. There are also other languages which can be compiled to Java bytecode; I don't know how well-suited they are for Android programming.
You could try to use another language for the Java platform. Unfortunately you'll be rather limited there as well, because J2ME is based on a rather ancient version of Java SE and most modern languages for the Java VM need either Java 5 or at least Java 1.4.
Lua runs very well on small devices (I use it on my handheld), but it is designed to be coupled into a C API. You may well have to write glue code yourself, which is easy, but if the official APIs are Java APIs and there is no C API, you'll be out of luck.
Actually C++ is pretty universally supported at this point. However you are completely stuck with Java for Blackberry.
Technically, I think the second (JavaME being first) most widely deployed runtime worldwide is Flash Lite.
Whether it would be a good idea to use it for your game development is another matter entirely of course.
Number three is Symbian OS C++ but that won't work on your Blackberry.

How can Java code be quickly converted to .NET (specifically, ASP.NET)?

Are there any tools available to simplify the conversion?
What percentage of Java code is converted exactly to .NET code by these tools?
You can try IKVM. Saxon, an extremely popular Java XQuery/XSLT engine by Michael Kay, uses IKVM.
IKVM.NET is an implementation of Java
for Mono and the Microsoft .NET
Framework. It includes the following
components:
* A Java Virtual Machine implemented in .NET
* A .NET implementation of the Java class libraries
* Tools that enable Java and .NET interoperability
http://www.ikvm.net/
You could try this one
http://mayaf.org/janett/
Janett translates Java syntax, constructs and calls to Java libraries to C# / .Net counterparts.
Java is roughly equivalent to c#, so translating to c# should be relatively straightforward.
The path from a Java webserver to ASP.NET is less clear.
You might try to the Java Language Conversion Assistant from Microsoft. I think they may have dropped support, but now ArtInSoft seems to have a related product:
http://www.artinsoft.com/pr_jlca.aspx
There's also Octopus from Remotesoft:
http://www.remotesoft.com/octopus/
The issue with porting from Java is usually not so much the language itself, which is pretty similar to C#, as it is the libraries.
Of course, a web app will present an additional layer of complexity. If the app doesn't have too much code at the page rendering phase, it shouldn't be very difficult. If the page is riddled with code, then you may be better off re-writing it than trying to port directly.
Have you considered using J#? It's no longer supported but if you're just trying to get onto a .NET language, that might be the fastest path.

Categories