Java applet in a Delphi form - java

Is there any way, without using TWebBrowser, to load a java applet in a Delphi form and interact with it?
Theres a page which contains a applet that I want to show inside my Delphi app (in a particular form) and after the user close it (or do any other operation) I want to interact with it (getting some details about what user did).
I know that TWebBrowser is capable of loading a java applet, but it will not let me interact and get what I need.
Similar thing can be done with a .Net assembly, but I have not seen anything like it using a java applet.
Edit:
As #PA pointed out:
"it will not let me interact" ... well, that's the actual reason for browsers running java applets inside a sandbox
Well .. that was not what a meant. I meant I am not able to get a value from a edit (for example) as I am able to do with other languages. I know that java runs inside a VM, but .Net runs as well and i am able to interact with .Net using some COM and stuff like that.

I think the only way to use Java Applets in Delphi programs wihtout TWebBrowser is to use ActiveX technology. May be this link from google can help you: http://www.oracle.com/technetwork/java/index-jsp-141438.html

May be you should take a look at Java Native Interface (JNI) technology. For example, you can find its Delphi implementation here.

Related

Can we use Dukescript as an applet replacement?

I read that DukeScript, a technology meant to bring Java to every client without the need of a plug-in.
Can this technology used as an applet replacement?
In geneneral I'd say yes.
Is there a particular reason why you would choose to use java applets in the past, meaning: did they need to do things like accessing the hardware and/or file system?
If your applet would do nothing more than what JavaScript would be able to do, then yes, you can definitely look at Java to to JavaScript solutions like GWT or DukeScript. They're quite different: one translates Java source code to JavaScript, the other one uses Java VMs written in JavaScript in order to run bytecode. Regardless, they're subject to the same limitations, when deployed to standard browsers. DukeScript though can be packaged up as a standalone app, running inside the JavaFX browser or as a native app on mobiles, therefore it can do more than standard JavaScript can do.

Open source Web based Java compiler

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

Is there a way to make a very simple IE browser with java?

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.

Is it possible to run a Java program inside a Flex application?

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 ;)

How can a java library be ported to the web?

How do you take a java library that is for the desktop or an applet and make it so you can use its functions for a web page? I know not all things are meant for the web, but can you call a "regular" java class in an apache/tomcat setup server and it "work"? Do you have to so something to it to get it work with a web page?
I was interested in jgrapht for the web but it looks like all desktop or applet and I don't know that it would be possible to return its graphics to the browser, but maybe its libraries and a generated .png rendered by the browser.
Although there is debate on applets being alive or dead, I am not interested in using one at the moment, as it appears it is dead, albeit with new possible life in the latest update 6u10. I don't know that I want to invest in JavaFX either.
Johnny, the thing is that you have to decide what you mean to do. You could, for example, use JGraphT in server side code; the graph could be visualized in a bunch of different ways, like JGaph or graphviz. Then you would output the visualization in some form that works on the web and put it into your web page. In JGraph, that probably means a print interface that generates SVG or PNG.
Or you could emit the graph structure as JSON with a simple walk of the graph and interpret it on the fly in the browser using Javascript.
It's hard to answer the question generally, because it strongly depends on how you mean to use it.
Yes, it is possible to use a java class or jar file in a web appliaction, but it also depends on what you want to do with it.
For example if the library is for mathematics and you want to return results back to the users on a web based application, this is definitely possible. There are many other examples I can give but they are all the same.
As for displaying charts, I have successfully used JFreeChart in a web application using Apache Wicket (which rocks btw).
So to answer your question, you don't really need to "port" the library, you just need to use it and display it's output to a web page instead of a java desktop GUI.
Of course their might be some libraries that are specifically designed for Java GUI stuff like Swing or AWT. But for the most part there is no difference in using a Java library in a J2EE environment or a J2SE environment.
There isn't a closed-form answer to what you are suggesting: porting a Java Library to a browser's environment and using its functionality.
If you are interested in graphing things, here are a few things you can try:
Open Flash Chart - a scriptable flash app that will produce graphs
Bluff - a Javascript library that produces graphs
processing.js - a port of the excelling 'processing' library to Javascript
As for accessing Java-based functionality in the browser, there are some approaches for that. One is to use a toolset like GWT that complies java into an HTML/Javascript/Java application. Another is to use an AJAX-based technology like Direct Web Remoting. It really depends on what you are trying to accomplish.

Categories