I have a JavaFx application. I tried several times to deploy it in an HTML page, but I got nothing. I use jre 9. I also tried to do it with Java web start, but when I open the HTML page, I get the following error: Java security settings have blocked your local application to run.
I changed my Java security settings in the Java control panel, but it's still not working. Please help me, how can I do this?
Related
When developing a web page, IntelliJ has browser icons which appear in the top right corner of the editor when you mouse over the area. It used to be for me that if the active file in the editor was a JSP, I could click on my IntelliJ-Chrome icon. This would launch Chrome and what would be displayed would be what the JSP would look like in a browser. I imagine that it was a preview of sorts. This way, I didn't need to run my entire program when all I wanted was to see what my JSP looked like.
I recently reinstalled all my software and lost all my previous settings. Now, when I click on my IntelliJ-Chrome icon, Chrome just displays the JSP source code that is in the editor. How do I get Chrome to run the JSP instead of just display the code?
Everything works fine when I run the entire project through Tomcat.
Additional information 01:
I noticed that when Chrome is displaying these JSP's, the address bar shows the location of the file on my hard drive rather than through localhost. I do of course have a Tomcat Run Configuration set for the project, so I wonder if there is a setting in IntelliJ that is causing the JSP to not get sent through my Tomcat configuration. I have looked this up in the IntelliJ forums and found this post which addresses a similar issue. The answer given is:
You have to configure and mark as default a deployment entry at
"Settings | Deployment
Additional Information 02:
When using these icons, I believe what is launched is not necessarily any run configuration, but the path configuration of the browser. This is located in IntelliJ at Settings -> Tools -> Web Browser.
I can modify the path to go to http:\localhost:8080\, but what this does is launch the OS default browser, not Chrome, at the project welcome page, not the active page in the editor.
You need to have an active Tomcat run/debug configuration. Once you start it and the app is deployed on the server, clicking the browser icon in the editor will open the URL corresponding to the the .jsp file in the browser.
IDE needs to know the deployment context and the server URL for this feature to work which is not possible without Tomcat run configuration.
Clicking the icon for index.jsp in this example will open http://localhost:8080/index.jsp in the browser.
Your Tomcat server is responsible for rendering of the JSP code. Browser just parces HTML (potentially with CSS/JS). JSP is serverside technology. You should run server first, than your favorite icon should work.
To start off, I am launching a jar over Java webstart and it has worked fine on all browsers in my lab. An issue arises where, at a customer site with all their various IT restrictions, it only seems to work on Chrome but fails on IE and Safari browsers.
I launch the jnlp via an html file through the browser. The link I used was:
<script src="https://www.java.com/js/deployJava.js"></script>
Launch ApplicationApplication</a>
I attempted to change this to:
<script src="https://www.java.com/js/deployJava.js"></script>
Launch Application
Reason being is my company has another webstart app that works in all browsers at this customer's site and their link looks more like the replacement.
So what I'm seeing with the replacement is that the JNLP is not being launched from the browser but instead being downloaded locally. When launched it attempts to find the jar relative to where it was downloaded. Not sure what I'm missing and why it is trying to download instead of launch via webstart?
Any ideas? Thank you!
I have been fighting with this a lot in the past. So couple of rules in general needs to be followed in order to go smoothly.
make sure your URL where jnlp sits is not cached, maybe you need to develop some Pragma No Cache, etc. things on the server so it doesn't treat it as static resource
clear cache of JNLP, see https://www.java.com/en/download/help/plugin_cache.xml
Check the shortcut icon on Desktop(assuming OS is windows), sometimes it creates crappy shortcuts, you can edit the shortcut and put always your URL, not the cached one
if that doesn't help you need to upgrade or downgrade java, depending on the case
In the past I even made special script which was downloaded and executed on client machine to fix the shortcuts .lnk files because of this buggy java functionality.
I have created a Swing application in Netbeans that is basically a chat system (between multiple clients and server using socket programming).
Now I wanted to run this application on a webpage. Is this possible without changing any code?
Now I wanted to run this application on a webpage. Is this possible without changing any code?
No. It would have to be a JApplet to be embedded in a web page, and applets have been effectively killed off. See Java Plugin support deprecated and Moving to a Plugin-Free Web.
On the other hand, a desktop application (based on a JFrame) can be launched from a link on a web page using Java Web Start.
Edit
Scrap that advice regarding JWS, apparently it too is being deprecated as of Java 9.
As same as the title, is that possible to achieve this right now. Since I have already had application that works on web browser. I want to create a java version app which just simply load the URL and performs most of the functionality as the web browser.
I have tried to use JavaFx webEngine, it can show the content of the page, but it does not support upload or download. For simplicity reason, I do not wish to rewrite code to handle upload/download or even more duplicate stuffs in feature.
I have tried JDIC, but seems it is abandon project and I have got such error:
org.jdesktop.jdic.init.JdicInitException: java.lang.UnsatisfiedLinkError: no jdic in java.library.path
I do add the jdic.jar which I download from nowhere to the lib path.
I also tried this link (http://www.codeproject.com/Articles/514/Embed-ActiveX-controls-inside-Java-GUI), but it is from 10 years ago and some components have been remove from JDK.
Any help will be appreciated!
I've been stumped for a while trying to figure out why my GWT demo app isn't working in hosted mode so I went back and downloaded the Google Web Toolkit again, unzipped it and simply went to the samples directory and ran "ant hosted". The hosted browser launches and only shows the static html content but none of the dynamically generated js widgets, etc. However when I click "Compile/Browse" the examples launch correctly in Firefox. What could be wrong with my setup/environment?
I followed the link you provided to download gwt. Extracted and ran "ant hosted" under samples/Hello, samples/DynaTable, and samples/Showcase and they all worked successfully. I'm also running Windows XP and java 1.6.0_11.
I think that running "ant hosted" starts an embedded Jetty server that listens on port 8888. Hosted Mode Browser makes requests to that embedded server, for example: http://localhost:8888/Showcase.html.
Also, when you click "Compile/Browse", it opens your default Browser (in my case it's firefox) and it tries to make a request to the same embedded jetty server that the hosted mode browser uses.
So, if it works in your browser, then the browser is connecting to the embedded jetty server. It's very strange that hosted mode doesn't work properly but you're able to view in a browser.
I believe the difference here is that hosted mode runs pure java (some sort of javascript emulator, I'm not sure I understand 100%), while the browser is running javascript.
So, I suggest troubleshooting the jvm that is started when "ant hosted" is run. Maybe the jvm is running out of memory or something when you load it up in hosted mode browser? Maybe you can pass some jvm args to the ant script to fix the problem?
Sorry I can't be more specific, that's a strange one!
#Chris: I suspect this question may have something to do with your earlier question if it is on the same computer that you were using. The solution may be to clear your IE cache because it tends to cache the 'script' tag contents and when it got messed up earlier while you were importing other stuff, it may still be sitting around in IE. Found the potential answer at this link.
I created a new workspace, re-imported everything and used GWT 1.6.x instead (because Ext GWT 2.X, which I need for this project requires GWT 1.6.x). This did the trick... everything works ok now.
The main difference I can think of is that in the Compile/Browser you are opening the html host page like a regular file, while in the hosted mode (even in a client sample) it has to be provided by the http server via localhost:8080. Check if the server is beeing started.