Embed html/javascript/css in java/c++/python - java

So, I have a fully functioning html/javascript/css web app, not sure if that's the right term, it works fine and dandy in a web browser.
The thing is I now have to move it OUT of a browser, OFFLINE, and to the "desktop", make it a standalone app. I would have to somehow wrap it in java/c++/python something, to make it run like that.
I really like Java since that is the language I know out of that list. I have looked into Rhino & Gecko. I haven't really found anything that is a nice plug and play. Like here is my .html file now run with it. I assume it would have to be in a swing window or something too.
Any hints/help/comments?

(As per request, I reposted my comment as an answer.)
The Atom editor is built using only web technologies, and uses the Electron framework (based on the Chromium browser) to run as a standalone application, with no external browser dependencies.
It looks very easy to set up something similar yourself, and basically just requires you to put your files in a special directory. (Electron uses a lot of space, though, so it may not be practical for distributing applications below ~20 MB.)

If you are really looking for an option where you just point at your current html and are off then you might just want to configure run a local web-server. It changes almost nothing about how you are running your application except where it is being served from.

Related

What does one do regarding applets now that Chrome doesn't support Java?

Without thinking, I created an entire program in Java and began designing a website to use this applet. All it does is create image in a certain way but there is a bit more code (classifications and default values/images) that I just felt was easiest to do with Java. Now I have a Java app and HTML CSS and JavaScript that I can't seem to do much with.
I have thought of 2 ideas (below) but I don't know what the general alternative is to applets nowadays.
I have a spare PC I may use and just alter my applet to run the back-end of a server-based site instead, but I am hesitant to use my own IP and bandwidth for something like this. Also, this app doesn't even need access to the internet so this just seems like way overkill.
I could just release the .jar, but I plan on expanding the available options. I also told people that this website was coming. I'd like to be able to just update the website.
I don't really plan on writing my program in another language. This took me time to make. If there is no way to work Java into my site, I may just abandon the project altogether.
I am mainly concerned with Chrome for this problem.
Edit: I would like to use GitHub as my host, just in case this helps at all.
You can run anything you want on the server, including java programs. So
you could run the image creation program in the server and present the
resulting image using a standard img tag.

Necessary and sufficient conditions to run Java applets and JWS applications in browser?

I have already asked this and was heavily downvoted. Unfortunately, I still can't solve it. I don't know what I do, but sooner or later I loose an ability to run java applets and java web start applications in all browsers.
Here is an example what is happening.
I am opening page with applets http://csis.pace.edu/~bergin/Java/applets.htm and getting the following picture:
with signs plugins were blocked. I am trying to unblock
which causes another dialog
after OK I have another
next
if clicked
And so on.
Applet doesn't run.
After dancing with PATHes, Java updates and so one, once I can have applet run. But sooner or later I will stuck in this position again.
I would like to know, is it possible to exclude this situation in principle?
I mean I don't want to disable security at all, but I mean that in case my explicit permission everything should run. Is it possible to do that?
UPDATE
First of all, I don't understand, why can't I run applet on outdated java if I want?
I am a human and robots should obey me! :)
Suppose I wish to debug my applet on old version of java, why not?
Second, there is no information about what version it thinks I have and what version it wants?
Without this information it is possible that there is just a bug in version detection mechanism.
I have multiple versions of Java in Program Files since I am a Java developer. Then how can I know which one it uses?
UPDATE 2
I have updated my Java from 1.8.0_20 to 1.8.0_25 and now situation have changed, but applets are sill impossible to run.
The proof I have "latest" java:
The proof I have added the site above to exclusions list:
The effect of applet run:
(applet not runs)
Clicking details result:
(no any details in fact)
So, what to do?
UPDATE 3
This site is not working: http://ssd.jpl.nasa.gov/sbdb.cgi?sstr=2012VP113;orb=1;cov=0;log=0;cad=0#orb
(show orbit diagram)
Reloading/restarting browser does not help.
I looked at your html source and realized you're using the .class file directly instead of wrapping it in a jar file. This is what you have:
<applet code="GSort.class" width=700 height=400>
I think applets no longer work when using .class files directly due to new security requirements. They have to be wrapped in jar files because you need to add some security settings to the meta-inf folder of the jar file. Here is how oracle recommends deploying an applet:
https://docs.oracle.com/javase/tutorial/deployment/applet/deployingApplet.html
Edit:
I tried again with adding the site url to the Java security exception list and this time I got it to work! It looks like chrome stays in memory after exiting so changing Java security doesn't affect it unless you shut down chrome completely and restart it. Easiest way is to use Internet Explorer. Try it with Internet Explorer and it should work (assuming that you still have the site added under java security exception list).

updating JUST HTML files on Google App Engine

I have a Google App Engine Application, and as part of that Application I have my standard HTML pages, Home, ContactUs, Testimonials, Pricing ETC ETC, when users click on "login" or go to a specific URL eg (www.diarybooker.com/demo) it loads the actual application.
All these standard HTML files are fairly static files though, with analytics and SEO etc in them, however in order to update these currently I need to release a new version of my application every time.
Can anyone offer any advice as to how I can JUST update the HTML without having to release a new version of my application (especially if I am in the middle of a development cycle and don't want to branch just to update a contact number or fix an SEO issue etc)
It is entirely possible that I am actually using the system incorrectly and that I should be re-wiring things better/differently, but I cant find any information about how this SHOULD be setup, and Im not even sure what to search for either, so if anyone can at least point me in the direction of some information on this, I would be very greatful!!
By way of an alternative example, I have a friend who is running www.wineathome.org.uk and if you click on "attend a tasting" it moves off into http://wineathomeuk.appspot.com. Clearly this is not very clean and is also not the way to make it work, I could embed the application in an iframe, but is that really the way to go?!
You have your application code in source control, right? I'd suggest that you create a deployment directory and clone into it the version of the application that you want to have running on AppEngine. Then, copy into the deployment directory the versions of the HTML files that you want updated. Deploy away.
That is the only strategy that's going to work for you. The GAE deployment tool only deals with your application as a whole.
Looks like you have a couple of issues going on.
On the first issue as #AdamCrossland states you can use source control. I use git and create branches for my application at different versions. If you do that you can merge your updated HTML back into an older branch then update your application from that branch. That way your only changing the HTML files and leaving the application in it's current state. App Engine deploy is intelligent and will only upload the modified files. Doing this from Eclipse is a bit more difficult than from the CLI IMO, but YMMV.
The other issue of a friend clicking on attend a tasting routing the url to appspot is a bit harder to deal with unless some code is provided. I would think it is because the code is doing a redirect to a hard coded URL. I have several application mapped to a domains and none of them route to appspot unless I forced it to in order to use some functionality like HTTPS which only works on appspot.com. I personally try to avoid iframes it opens up an avenue for exploits.

What is a good GUI tester?

We need a tool to test a set of fairly complex Java applications. The applications are mostly independent client programs or applets communicating with a servlet or apache server at a remote site. Specs:
Runnable on Windows XP, Vista and 7
Parameterizable (Can specify in a script the sequence of buttons to click, text to type in JTextFields and browser address bar etc.)
Can quit or bail out or display a nasty message if the expected window or dialog box doesn't appear
Record the output on the Java Console of browser in a .txt file (IE is sufficient for now) when the application opens a browser window.
While running, I should be able to see it running with folded hands while it would run
for a few minutes
We were thinking of writing an AWTRobot based tool that reads a command file and does this - (don't know how to do #3 or #4 yet - will ask you folks some day how to detect a window on the desktop). Would you suggest an open source tool available to do this? We don't need anything fancy to capture video or screenshots. Thank you, - M.S.
For browser based automated testing you can use Selenuim or you can use WebDriver.
The selenium project is hosted here
If you don't need to test the way the pages are actually rendered by the browser, but instead need to work at the HTTP/HTTPS/etc request level then have a look at JMeter. It has parametrization, dataproviders, graphs, and a proxy component for recording http user sessions.
If you do need browser testing, then, as has already been mentioned, Selenium is probably the best freely available tool. For production I would recommend using Selenium Remote Control server which can be driven by scripts written in Java/Python/C#/Perl/PHP.
To see what tools people use in real production environments, and to do your own research on what is available I recommend www.sqaforums.com.
Have a look at Sikuli
The reason I suggest this is it sounds like you need to test both a Java applet and the content of a native browser (launched from Java, but not itself Java) -- so it's not "Java all the way".
I'm not sure what you mean by criteria 4, though. It is worth noting that as Sukuli works by image analysis, it won't be able to copy text to a text file.
This question is an invitation for sales pitch, don't you think. How about Mercury Quicktest professional ( I believe its HP Quick test now). I do not believe this will be cheap either ( and well its HP, it will probably only work in IE ;)).
Since you want an open source solution, I believe, the most popular option is selenium and yes its a pain to configure sometimes ( like for Flex for example). So you should try Watir.
There is a lot of good buzz around it and when I evaluated it, I loved what I see.Also it does not work for desktop applications, I suggest you try some other solution for that.
(The problem is open source GUI testing tools are not usually all inclusive. If you need one solution to handle all your gui testing needs, then you should check out the more commercial ones like QTP.
I have used IBM Rational Functional Tester. It has everything you need and it's quite easy to learn. The scripting language is either Java or VB.Net so you won't have to worry about learning a language for your tests.
I had some pretty good results with Squish from FrogLogic and didn't break the bank: http://www.froglogic.com/products/
Did you try Squsih - http://www.froglogic.com/products/index.php

Use SWT Browser Widget to Write Desktop Application

I recently played around with the SWT browser widget (which is great). I am wondering if I could write a full desktop application with it (with java services behind - e.g. persistence) and what drawbacks I would have to consider. The advantage would be that people without java knowledge could work on the gui. Of course it depends on the requirements and I know that this is not a very specific question. But mabye someone already tried to build a bigger app this way and is willing to share insights.
Thanks
Marcel
I'm not sure I share your opinion of the SWT browser widget. AFAIK it's merely a shell into the default browser on your machine, merely with a few API access points. I've used it for minor things when I needed to show a web page from within the application. But writing a whole application? That doesn't make sense.
If you want to build a web-based application that runs in the browser against a Java based server framework, there are many AJAXian frameworks to do it. You'd still be doing JavaScript for your client code. And you'd still be dealing with all the complexities of different browsers. I'm not sure why you would want to host it inside an SWT application instead of just directly in the browser window.

Categories

Resources