I'm learning Java programming now, and I wanna use Java classes that I created in my PHP systems. Every tutorial what I found is too old and the links doesn't exist anymore. I tried to use "apt-cache search php-java" in my terminal but no results came (I think this just works for repositories, am I right?).
Does someone have any help?
I use Ubuntu 15.04, php5.6.4, java 1.7.0_85 and my system is 64bits.
Thanks for the help :)
I have noticed some websites using like this, can not remind now, but I think you can do that through JavaScript . Passing the data to JavaScript and retributive it and again use and send result through JavaScript . PHP has support for instantiation of Java objects and using them transparently as PHP objects.
and Integrate PHP and Java Applications with Oracle WebLogic Server and Zend Server 5.0
may help you , but truly never did it and having no good knowledge of it.
Related
I have some experience with java ee development and some web applications.
Now I have to create a java program on AS400, one I have never heard before. Program is to create xml file from db2.
Do you have any idea how I should approach the development with no knowledge of AS400 and DB2?
I do appreciate any kind of suggestions and help!!!
Well, in general, Java, on IBM i (previously known as AS/400), is java ... and DB2 is accessed via JDBC... so there isn't a whole lot different to consider.
You'll want to get the JT400 library for a JDBC driver. Javadocs for JT400 can be found here.
If you have specific questions, or run into problems, consider subscribing to the JAVA400-L mailing list.
I am trying to write an extension to google chrome and I want to use my own java classes and it's attributes, methods inside a javascript code. I search on the internet but I did'nt find enough resources in terms of implementation. Can you give me any idea how to integrate and use my own java classes inside a javascript code. If you can help me , I will appreciate
Thanks.
This will not work. Both are totally different programming languages. Javascript is a script that is interpreted by the web browser. Java is a object oriented programming language that needs to be compiled and run in a virtual machine (JVM). Many people are confused by the similar names.
Isn't Google Web Toolkit (GWT) what you are looking for? It translates code written in Java to native Javascript to be run on the browser.
I wonder if it would be possible to integrate the generated code with your code, to run it as a browser extension, though.
If you need only instance variables of your classes, you would do well by converting your object into JSON and sending it to you extension. Check http://www.json.org/java/index.html. As pointed out by Marcelo, GWT will help you but only if you are deploying your app on Google App Engine. It is not for chrome extensions.
I guess you wanted a bean like access from a scripting language to java 'objects'..
http://commons.apache.org/bsf/ may help you to access Java objects and methods from scripting languages.
it claims to support javascript.
Mozilla has something like this through XP-COM.
also: see this, Chrome and XPCOM
I am wondering if you found a solution to this.
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
Have you experience of integration of php and Java? I've written a class in Java "Hello". Now I want to call its method from php when I create an instance of this class from php with
$obj = new Java(Hello);
Then it gives me fatal error. I've tried many times to setup php ini variables etc but I couldn't find anything. Please advice me how can I set it up.
Thanks in advance
Reference: http://php.net/manual/en/book.java.php
Have a look at:
PHP-Java Bridge
The PHP/Java Bridge is an
implementation of a streaming,
XML-based network protocol, which can
be used to connect a native script
engine, for example PHP, Scheme or
Python, with a Java virtual machine.
It is up to 50 times faster than local
RPC via SOAP, requires less resources
on the web-server side. It is faster
and more reliable than direct
communication via the Java Native
Interface, and it requires no
additional components to invoke Java
procedures from PHP or PHP procedures
from Java.
Could it be you are just missing the quotes around the Java Class? Also make sure you actually do have a Java VM on the machine you are trying to run the code on and make sure you have properly set up the config options. Also, the Java extension is a PECL extension and has to be installed. It is not part of the native distribution. Furthermore, the extension is considered unmaintained and dead, so you might want to have a look at the JavaBridge suggested elsewhere. Zend Server also brings a JavaBridge.
Check out this article: http://www.devshed.com/c/a/PHP/Using-PHP-with-Java/
They say it's possible (and how to do it). I've never done it, so I can't vouch for it...
In my experience the best way to interact between Java and PHP is through a WebService layer. NuSoap for PHP is very good, and you can consume the webservice in Java to create a stub that will build the request/response object.
There are many ways few are:
PHP Java Bridge
Java Integration in PHP
Using web services to pass data in between like SOAP
Using simple HTTP data passage between Java and PHP see (facejar uses the same technique)
Client site script (AJAX)
If you are after security, use option 1 otherwise I prefer using option 4 which is a bit faster when it comes to performance.
Is any way to convert a java applet code to java script?
Not really, no. They're different languages with different libraries.
If you want to develop for the client-side Web with Java, have a look at GWT
I don't think there is a good way to do so. Please remember: Java and JavaScript are two entirely different technologies. Don't mix them up.
Not directly and without effort as far as I know. However people have ported many things to HTML/JS, like Quake 2 on GWT. So you could invest some time and step into the code and port it with GWT.
Advantages of going with GWT arise from the fact that your applet is in Java language, which is the same language you use for GWT. Here is a list of what you can use in your code: GWT JRE Emulation
No.
Google Web Toolkit (GWT) is what you might need. I recommend book GWT In Practice 2008
12 years later there is now a tool called "JSweet" which claims to do exactly that: converting Java code to JavaScript: https://www.jsweet.org/
There is also a blog post from 2019 of someone using JSweet to convert some Java Applets to JavaScript: https://www.lprp.fr/2019/08/jsweet-convert-applets-to-javascript/