I'm trying to access Java from actionscript 3, so is it possible to call a Java class in actionscript 3?
If it is then how?
We need more information. Directly from flash, no. Is this a regular swf or an AIR app? Is it a java process running, or is it an applet on the same page? If it's a swf and an applet, it should be possible to bridge communications via javascript.
Actually there is an open source project which does just that. I'll be damned if I can recall the name offhand though.
You might also take a look at http://www.gotoandplay.it/_articles/multiplayerCentral/tutorials/pro_javaInAS.php
But again - as these guys have correctly stated above - all we really can do is throw random shotgun tidbits of information at you without a more specific question. What's you goal? What do you want you app to do? have you got some code you code post?
Have a look at Flerry which uses Air's NativeProcess API.
But I doubt that it will be possible to call Java from a non Air application because of flash player restrictions.
If you don't mind going with .NET - I heard someone say good things about WebORB.NET integration server. Wish I could be of more help Java wise.
Related
Disclaimer: If there is a similar question, I haven't found it and I apologize.
The thing is, I am in the middle of a hackaton with an inexperienced team. I am familiar with java, but there for frontend and they work in java. The thing is - nobody knows how to connect frontend and backend of a web app which we have to build.
Is there a way to make java communicate directly with javascript, maybe through a library or java class? I am asking that because we want to design a web app only in CSS/JavaScript.
If there is no way, could we make an invisible Java Applet which would be a "medium" between java and javasript, but does not require space on the page or interfere with design in any way?
I apologize again if the question is a closed discussion, or just plain ignorant, we're note here to win, but to learn without completely disgracing ourselves :)
Typically you would define a REST endpoint in Java, then communicate with the Java using an AJAX call from the Javascript.
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.
I want to create a web based java tutorials kind of project which involves jquery, css, jsp, springs etc .,
so I actually want to practice these technologies resulting a good product. The content of this tutorial can be edited by any user and rated by clients according to the chapter etc.,
I have few such ideas.
One primary idea being have a web based compiler and executor . Similar to w3schools. I know its difficult for a compiler of server side technology on a browser.
My questions are:
Are there any such open source java
compiler/executor services available
which can be used?
Is anyone interested to work on such
project (in case there isnt any)?
EDIT:
I am planning to use Compiler in java and Beanshell. Any better solutions ?
Google App Engine is the one, which one can you help to set up Free online Java Compiler, But for that you need to have an account to proceed.
Few other places you can defnitely Check
http://compilr.com/
If you have Applets,
http://www.innovation.ch/java/java_compile.html
EDIT : As Stephen Suggests, Download JRE and JDE and use it from oracle website
http://www.oracle.com/technetwork/java/javase/downloads/index.html
With http://www.browxy.com you can compile and run java console application and applets
You would need a script on your server that accepts the sourcecode, compiles it and runs it, however I'm pretty sure, you don't want to run arbitrary code.
If you still want to do it, take a look at Google's AppEngine, they do allow users to upload their (compiled) java programs and don't seem to have had any problems with it.
This question is interesting. In fact, Tomcat JSP server is an online compiler for Java Servlet. May help you a little in your case. (Not for traditional Java, though).
Imagine that you gave user an input form for Java codes ( preferably a WYSIWYG editor ), the codes will be written in a temp JSP file, and then your code compile and run the JSP.
But be careful , JSP is too powerful ( as it can touch file system, etc. ). Make sure your security measure is set.
I've used ideone.com before when discussing Java code with someone in a remote location. It is a web based IDE that handles Java as well as a lot of other languages, and is very useful.
If you are trying to do it yourself, you should be aware java6 and above have compilation built into the language in the javax.tools package.
You may want to check out Fixoncloud compiler. It's a web-based collaborative online compiler. Anyone can make changes to the code and you can also track history of your code. The compiler supports C, C++ and Java.
Depending on the permissions set to the code, the owner can also make his code completely private and permit only specific users to view/modify the code.
Here's the link to the compiler:
http://www.fixoncloud.com/Home/compiler/index.php?id=254
I have a small project that i was wondering if it is possible to do with java.
I know that VB .net has the ability to make a simple web browser using an Internet explorer interface. I was wanting to do the same thing with java. Unless somebody knows how to compile VB on linux and would like to explain it to me.
Please tell me if you need anymore information.
JEditorPane has limited HTML rendering support, but no javascript engine
If you want Internet Explorer specifically, it's not going to be possible in the same way. VB.net uses the part of Internet Explorer that is built into the system. In other words, it is referencing a part of the Windows system, so you need to be running Windows to use it, regardless of the language.
You would need to use a tool such as http://www.ezjcom.com/ to get a COM wrapper in Java, from there you can embed IE as an ActiveX object.
All of these pieces might make it a little slow or cumbersome, but it should be possible.
I would like to be able to incorporate a simple game, written in Java as a component within a Flex Application. Am I crazy?
Flex can display HTML, and SWF, it can also call JavaScript - but can I incorporate an applet somehow?
I do NOT mean kludging it in as a sister component within a browser, but actually within the flex application itself, so that it could also run under Adobe Air, for instance.
No, Flash doesn't have a JVM. You would need to convert your Java to ActionScript somehow.
Running a Flex application inside a Java program is possible, not the opposite.
It might be possible to compile a Java Virtual Machine (if it's written in C) using Alchemy... but I don't think you want to go there, converting your code would be easier and cleaner ;)