Originally I had an applet that contained SQL server/jdbc stuff and wanted to use that applet in html but I guess it's not good to use SQL in html? because i kept getting millions of errors/exceptions and realized my applet would only work if i commented out my SQL code.
but anyways, is there a way that I can have a button on an html page that when it is clicked it will run the runnable JAR application not the applet? without causing errors..
I'm not sure what a JAva Web Start is or what a JNLP is but if anyone could explain/help? the Oracle Website doesnt explain well enough like how do i create a JNLP?
I currently have a runnable JAR file that was exported from eclipse that opens & runs when I click the icon
You are correct that Java Web Start is what you want to use. You have your JAR file built already, so you should be good to go by following this Deploying a Java Web Start Application tutorial
This will walk you through signing the JAR file, creating JNLP file. This web site contains an example of a JNLP file, and also contains more documentation on the structure of the JNLP file here
You'll then create a few simple lines of JavaScript, to be triggered when the user clicks a button. Something like this, as mentioned in the tutorial:
deployJava.createWebStartLaunchButton(URL_TO_JNLP, '1.7.0');
Related
I have a html file, there are links in it, I wonder if there is a way to use those links to call a java program to generate another html file ?
Something like this :
<Html>
<body>
Some text
<A Href=[somehow point to a java .class file to run]>My Link</A>
More text
</Body>
</Html>
I know how to use Java to generate html, what I'm asking here is how to pass a parameter to this local java class so that it can generate html file with the input ?
So if the Java program is called : MyHtmlGen.java
Then the class will be MyHtmlGen.class
And then if I run it from the command line, it would be like this :
> java MyHtmlGen my_input
But I don't know how to turn that into the html link above ?
You could use WebStart to launch an Java application from a browser interaction.
The section of the linked documentation titled: "Running a Java Web Start Application From a Browser" provides a demo you can try. The link to the Java application is provided as:
Launch Notepad Application
That documentation states that when you click the link:
Java Web Start software loads and runs the application based on instructions in the JNLP file.
That isn't the behavior I get on Safari 7.1 on OS X 10.9 with Oracle Java 8u40 installed. Instead, I just get the jnlp file downloaded and can double click on the downloaded file to run the application. I think on some browsers, Oracle may provide a plugin to the browser which is able to launch the jnlp referenced application automatically without the user having to also double click on a downloaded jnlp file. Perhaps if the Java deployment toolkit were used, rather than a straight a href link, the user experience might be a bit more seamless.
Note: browser manufacturers have been phasing out support for plugin technology like this, so the experience or even the ability to automatically run the referenced application may vary for both you and your users. Additionally, allowing such plugins to run within a browser environment can increase the security attack vulnerability surface for a user's browser. WebStart is also quick a tricky technology to use and support for your users. So for these reasons I normally don't recommend using WebStart as a deployment solution.
That's just impossible. A link <a> will fire a GET request to the server for the URI set in the href attribute, it's not meant to execute a specific piece of code. If you want to execute code when clicking a link, use JavaScript, but be aware that JavaScript cannot start an instance of JVM and run your exact Java application.
On the other hand, maybe you should look into Applet or JavaFX and embed the java application in your page. Or probably you may submit an action to the server, and at server side you may start the JVM and execute your Java code.
I have a button and when I click the button on the website, my Java application which I save it as an executable jar file will pop up. How should I do it? Is it possible to just use a href command or onClick command? But it doesn't seem right. Or do I need to play around with the server, as in this case I use Wamp as my server.
Hoping to get some suggestions from the team. Thanks!
Java already has a technology for doing this and is called java webstart.
This is what you are looking for : http://docs.oracle.com/javase/tutorial/deployment/webstart/
See an example here :-
http://docs.oracle.com/javase/tutorial/deployment/webstart/developing.html
I am new to oracle fusion development using oracle adf framework.
Well my question is that when we create a project we have two projects inside first one is model and the other one is viewcontroller.I have a made a task flow and deployed it on a jspx page.When I run the application it pops me a box for target file, is there any posibility to make a welcome file where I just start the application and the application starts with that welcome jspx page.I have also defined a jspx page in welcome file list in viewcontroller's web.xml file but it continuously asking me about the target file to run.
Any help would be highly appreciated.
In addition to Shay's comments, you can try below option also,
Go to ViewController project properties >Run/Debug/Profile option>Default configuration>Enter
appropriate page in "Default Run Target"
You can right click your specific JSPX file and run it directly.
Or alternatively when the " box for target file" pops up - just choose your JSPX file and make it the default run target.
I have a client who has a java based game which he wants to make available online (at the moment it is desktop version which he had to install). He asked me whether I can embed it into a webpage. After trying for several days still no joy. Can you please point me to the right direction. It have fives jar files(executable jar file) and a folder called lib which has five more jar files. Now I don't know whether it is possible to embed the game using applet/object tag. Can you please point me what to look at when dealing with these jar files.
..at the moment it is desktop version which he had to install..
Launch it from a link using Java Web Start. It might be necessary to digitally sign the Jars (what does the app. do?).
Note that a 'desktop application' would typically be coded using a JFrame, whereas the equivalent top-level container for embedding is a JApplet. A frame cannot simply be embedded in a web page.
As the rest of the problems mentioned, you'll need to be a lot more specific about what you tried and the results of those attempts, or find some psychic helpers.
Background
I've made a Java application that is started by downloading a dynamically generated .jnlp file. What the application does is not really relevant, but its a screenrecorder. The user will download and start several (maybe hundreds) of these applications over time.
Problem
When the program ends I would like to delete the jnlp file that started the application. The point of the program is that nothing should be installed and nothing left behind. That includes the jnlp filed that one download to start it.
Question
Is there a way to find the jnlp file so i can delete it? (Preferably a File object)
Look up system property var jnlpx.origFilenameArg and delete it from the java application.
This worked on Java 6 update 26.