GWT is pretty cool: write in Java, we build an Ajax app.
Is there something similar for Flash? Code in Java, we convert it to Actionscript?
Thanks!
I haven't use any myself but found these from osflash.org
This seems to be doing something of the sort. http://www.flagstonesoftware.com/transform/. Then there is haxe which doesn't do Java as far as I know but might be worth looking into.
UPDATE:
I just found out that ANTLR will also talks ActionScript. You'll have to define a formal grammar that translates other languages into ActionScript (http://www.antlr.org/wiki/display/ANTLR3/Antlr3ActionScriptTarget)
I'm not sure is available yet, but Joa Ebert showed a Java to SWF compiler at last Flash on the Beach. You can read about it in Compiling Java and C# to SWF.
Cheers,
Related
Is there are tools for converting java code to php? I have source code of java library and I need it to convert to php.
It is possible to automatically convert it. This is called a source to source compiler. Normally when you compile software, the parser will build an abstract syntax tree and convert this into the target machine language code. But it is just as possible to have a compiler convert this into another high level (compilable) language.
Java is a strongly typed language, and PHP is not, so source to source compilers are rare and the code conversion process is incomplete. However this said, there is a reasonably good one with a free demo at: http://javatophp.com
Automatically - No. Now. Maybe in future. Don't spend time, write new code bro.
I don't think there is a solution like this currently.
You might try using a php-java bridge that would allow you to call the java code from within PHP:
http://php-java-bridge.sourceforge.net/pjb/
Zend Server also provides a bridge
Team of 5 folks at Facebook have spent 18 month to write sofrware that converts PHP to C++ (meet: HipHop). There is no such software for transforming from Java to PHP yet.
The answer is: yes... it is possible if you have year and a half and team of pro programmers :)
Otherwise, you rewrite it manually (I think, this is your choise).
There are lots of aspects of Java that cannot be expressed in PHP. Type safety for one. This sounds like a fool's errand to me. If you were looking to go in the opposite direction the question might have some interest.
Are there compilers around that use a syntax other then the java language syntax to produce JVM bytecode?
Lots! scala, jruby, jython, Groovy, Clojure etc.
See http://en.wikipedia.org/wiki/List_of_JVM_languages
I don't know what you want to do but there are lots. You can even port Java code to other platforms like android.
Depending on what you want to do with the byte code you might like to look at Jasmin which is a Byte Code assembly language and ASM which is a byte reader/minuplator/writer.
You can even compile LOLCode based on the language of LOLCats :D
HAI
CAN HAS STDIO?
PLZ OPEN FILE "LOLCATS.TXT"?
AWSUM THX
VISIBLE FILE
O NOES
INVISIBLE "ERROR!"
KTHXBYE
Plenty. Look at this list of JVM languages for some examples.
There are plenty of them ...
Lisp : Lisp as an Alternative to Java
Scala,
Jython,
JRuby,
Groovy etc ..
Have a look at the following link :
Modern Alternatives to Java
Have you looked at Scala?
Alternatively, there is JRuby, Groovy and lots more arriving all the time. Scala seems to be the one that gets the most press at the moment though.
is there a tool which can convert actionscript3 source code to java source?
I ran into this page awhile ago because I needed an actionscript to java converter too. I wrote one myself. It's very simple and requires manual adaptation after conversion (as most such converters do), but it does a good job of automating the boring stuff. You can find it on
my blog.
I believe Haxe (which has similar syntax to AS3, also based on the ECMA Specification) is able to compile to Java (as well as a slew of other languages and bytecodes). It requires learning a new language, but it may be worth it.
You should explain why you want to convert from AS3 to Java. I think, the typically way is to convert from Java to AS3, e.g. with Gas3.
You will be able to do this via Haxe in near future. First use as3hx to convert AS3 to Haxe, and then you can convert Haxe to Java via Haxe compiler. Haxe/Java was promised to be relased in this year.
I know the .Net framework very well and know where to find things ie: StreamReader, StreamWriter, Graphics, etc, and I know Java has similar things. The syntax is different but quite similar to c++ which I have a lot of native c++ experience. Therefore, what would you recomend as a good starting point for tutorials and such. Thanks
In my new job, I quickly found myself working on a common library in C++, C# and Java. I had no Java knowledge and yet found it pretty intuitive to make simple mods to the Java code - the general C# principle that there is a framework class/namespace for most things you want to do, appear to hold in Java.
The thing that bothers me is that this MO would not teach me tricks and improvements in Java that are specific to that language. That's where I would like to see other answers to this question lead.
In the meantime: http://en.wikipedia.org/wiki/Comparison_of_C_Sharp_and_Java
btw while I found C# and Java pretty congruent, I would not say the same about C++ vs Java.
If you work in eclipse/netbeans/intelliJ it may actually be a no-brainer. Guess at a class name, start typing it and hit ctrl-space (for eclipse, others vary). Regardless of which package it is in, it will find all the classes that match and list them for you faster than you could look them up anywhere else.
The other really nice thing to have on hand is the javadocs for the SDK you are working with--you can code effectively with nothing else. They are online (just search for JDK 6.0 or whatever version) or they can be downloaded from the same place you get the JDK.
The javadocs are your friend - once you figure out some of the main packages in java.*, it's easier to know where to look for specific classes / functionality.
Once you're writing some code, buy Effective Java - it's full of tips for the language, and is just a good programming book.
As you know there is a Syntax highlighter for PHP called GeSHi which supports a great number of Programming Languages or Code formats.
However, I couldn't find such a library for Java which supports programming languages that I need (ADA, ASP, BNF, Bash, Brainfuck, C, C++, C#, CSS, Cobol, ColdFusion, D, Fortran, Haskell, HTML, INI (Config), Java, JavaScript, Lisp, Make, Objective C, PASCAL, Perl, PHP, PLSQL, Prolog, Python, Ruby, Scheme, SQL, VB.NET, Verilog, VHDL, Visual Basic, XML.)
Do you know one or should I prefer inefficient way which is retrieving the highlighted code from a remote PHP server via http transaction? Any ideas?
Thanks.
Two related questions:
What code highlighting libs are there for Java?
Where can I find a syntax highlighting library for Java?
And one library I found: http://colorer.sourceforge.net/
Have a look at JHighlighter or jEdit Syntax Package. All mentioned languages aren't supported out of the box. However, you have the sources, so I guess it should be possible to add language support.
Not a direct answer but, if client-side syntax highlighting is an option, the SyntaxHighlighter library from Alex Gorbatchev is an awesome javascript library, supports lots of languages and is highly extensible.
You could use Pygments through Jython. Won't be as fast as a Java solution, but much faster than interacting with a remote server.
Barring that, you could run Geshi locally and pipe source code through it, that would also beat an HTTP round trip.
It seems that it is possible to run GeSHi from Java: GeSHi4J it seems to be a wrapper that run the PHP library on the JVM.
There is a port of prettify.js for Java: java-prettify.
It can be used to produce HTML (computed in Java), as I discussed here:
Use the java-prettify parser to create HTML
jedit is a text editor with syntax highlighting support for some 170+ languages via "modes". It also allows you to specify your own syntaxes. You can use the StandaloneTextArea component in your own application as follows:
Extract source (eg: jedit4.3source.tar.bz2 to d:\source\jedit)
Use ant to copy all the textarea files to ..\textarea eg:
D:\Source\jedit\jEdit> ant prepare-textArea
However, it misses the file BufferUndoListener.java. Copy this manually by executing
D:\Source\jedit\jEdit> copy org\gjt\sp\jedit\buffer\BufferUndoListener.java ..\textarea\src\org\gjt\sp\jedit\buffer\
In Eclipse create a Java Project from existing source in the directory D:\Source\jedit\textarea
Navigate to org.gjt.sp.jedit.textarea.StandaloneTextArea.java
Change the line
mode.setProperty("file","modes/xml.xml");
to
mode.setProperty("file","src/modes/xml.xml");
Run. Copy and paste an XML into the editor and see the syntax highlighting is working.