How to tell if a Java application was started by WebStart - java-web-start

Our app has 3 ways to launch...
Applet in a web-page
Desktop application
WebStart
WebStart currently launches the applet but we prefer it to launch the desktop class instead. However, the desktop version expects all resources to be there already whereas WebStart should download resources like an applet.
Specific code in each case is not the problem, but figuring out which way the app was launched is... we don't want to try downloading content for the full desktop application.

Some ideas:
Set a property in the JNLP files to indicate it is JWS.
Do a try/catch on loading one of the JNLP API classes. They will not be on the run-time class-path of the 'naked' desk-top app., but will for the apps. launched by JWS. Some examples of loading the JNLP API classes can be seen in these demos.

Related

Entreprise-Application deployed succesfully but it is not running

I am trying to develop my first web-application based on java-EE. This application should be deployed on WildFly application server. For That purpose, I made my inspiration from https://bitbucket.org/lassitercg/example/src.
I made some modifications on my Code.
I am developing this application using IntelliJ-Community. The Application was successfully deployed.
whenever I try to access the application using the following URL localhost:8080/startweb, I get the http status code 404. The code can be found unter this link https://github.com/amitakCsNew/startweb
Since I using Intellij Community edition, I am forced to deploy the application then set the breakpoint in the Controller of the application. The application seems to be succesfully deployed, but I am not jumping to the first breakpoint.
any Idea how I can solve this problem ?
Your webapp layout is wrong. Please refer to the standard Maven directories layout.
You need to move webapp directory to src/main. Then update pom.xml file reference to web.xml, then move META-INF from resources into webapp then fix your syntax errors in index.xhtml (the same h namespace is associated with 2 different URLs), then fix/implement your database, then add faces servlet in web.xml, add faces-config.xml, then your web app should be available at http://localhost:8080/startweb/.
Once you resolve all the problems and the controller code finally executes, you will be able to debug it from the IDE using Remote debug configuration.
If you are new to all of this, I'd suggest starting with something more simple, like a single JSP page and a single Java servlet.
Post the new questions if you have issues describing what you did to solve the problem and what exactly didn't work. The current question is too broad and your sample project has too many issues to cover in the single answer.

Building a Java Web Start App for Multiple Codebases

I have a Java Web Start application for which the JNLP is generated dynamically. The JWS application is built in NetBeans, which offers me several options RE the codebase for this app, including not specifying one. But so far, I've been using the "User defined" option, i.e., I've been specifying the codebase within every build. My question is, what do I need to do to get my app to run if I don't specify a codebase? Right now, I have to rebuild with a different codebase for each environment in which I want to run this application, which is not ideal. But if I don't specify the codebase, the JWS application won't run. I'm currently writing the dynamic JNLP to a ServletOutputStream. Would I have to write it out to an actual file first before I could use it?

Java applets in windows store apps

I have a java applet and i'm developing a windows store app. I want to integrate my applet to this application. Is this feasible.. if yes... can you tell the process.
Thanks,
Harsha
You won't be able to run this within a Windows Store application since plug-ins (you'd need Java installed) are not allowed for WebView (or for the non-desktop version of IE 10 in general - Flash excepted for some sites).
It is not possible at the moment. When you were installing Java you must have missed the Java doesn't work in Metro.
You should probably be able to run your Java Applet into a WebView but I am not sure if that's a good practice or not. You should convert your java applet into a HTML5/JavaScript application or C# application for optimum performance.

Web framework with user-friendly desktop deployment?

I'm building a web app with Backbone.js (I'm not tied to Backbone yet though). I need a back-end framework only for persistence to a database via a RESTful API. However, I also need to able to deploy it as a 'desktop' app for off-line use, i.e. running a local server and launching a browser window, but I don't want users to have to start a server from the command line to run the application.
I can use SQLite as a database since it's only a single user application, it's just the framework that I'm stuck on. I have looked at the following:
Rails and Django: Default web servers are too flimsy, requires Ruby/Python and runs from the command line. I'm aware of the Bitnami stacks but at 99mb it's too big of a dependency and not exactly hidden from the user.
Sproutcore: Run from command line, also too bulky.
Pyjamas Desktop - Depends on MSHTML which I suspect limits my ability to use HTML5 features.
I'm leaning towards creating a Java app that starts a Scala/Lift server instance and opens a web browser, then sits in the system tray (kind of like WAMP). Is anyone familiar with a tool or framework built for user-friendly deployment as a standalone desktop app?
I do not know if PHP is an option for you? Then I would recommend phpdock.
web2py has a standalone deploy-to-desktop feature with no dependency on Python: http://web2py.com/books/default/chapter/29/14#How-to-distribute-your-applications-as-binaries
As Eydun said, phpdock is an option but it's commercially licensed .
I settled on using Java/Spring/H2/Hibernate/Jetty. I find that Jetty serves requests VERY quickly so the application looks real-time when launched in a browser. There is a tutorial on embedding the Jetty server here. I imagine it's quite trivial to build a GUI that launches the server and a browser.
Another Java option is to use the Play Framework, which may be more at home to those coming from a Django/Rails background. However, the documentation for "creating a standalone version of your application" for Play 2.0+ indicates that they have ditched using Java EE containers (Tomcat/Jetty) and WAR files in favor of running the JARs with the bundled copy of JBoss Netty, so it may take a bit of work to get it running the way you want it.
I would recommend the Play Framework approach if you're OK with using/learning Scala.

I have a J2EE application that needs updating within a client's intranet

I have a J2EE application that runs fine and is accessible to the internet. Some of our prospective customers would like to use it, but are unwilling to send their data over the internet.
As a workaround I've thought of providing them with the war file and letting them run it themselves.
The problem is: how do I make it trivial for them to update the application when I make a new version available? The more difficult it is, the less likely they are to buy in.
What's involved in writing an updater that fetches the latest war file from online and updates the web application? Is this even possible?
In the least they would need to redeploy the war file. Most application servers have an interface through which you can upload a new war file. I am in favor of doing this process manually i.e. you send them a war file and they can use the app server's admin page to deploy the new war. This way they explicitly know when they are updating the app. Also they control when they want to deploy a new version of the app and easily roll back to an older version.
I would recommend using Jetty as an embedded solution. I have used a few apps that that use the embeded functionality. It allows you to create a packaged distribution of your application that runs a servlet container out of the box.