I'm trying to convert my java software jar into a Java WebStart application. I've managed to successfully deploy it as a WebStart with a jnlp file that provides details about the software's jar.
However, my software requires certain details to be stored locally in a file on user's machine. These details can be set & the file can be generated by having the user run another java software (a very small java utility software) coded by me. I wonder if it's possible to package in this smaller software's jar as well along with the main software using the tag. As far as I know, we can use the tag to specify additional jars/ libraries that our software jar uses.
Can we package in another java jar created by us in the jnlp and would it then get downloaded alongside the main software jar and other libraries (jars) when the user launches the jnlp ?
Kindly let me know. Thanks.
P.S: I know that all jars downloaded by a WebStart application end up in the deployment cache. Is there no way to specify where they should get downloaded to ? In my case, I would prefer it if the 2nd software's jar gets downloaded in an easier-to-find location.
Yes, it would be downloaded - but it would end up in the deployment-cache with no easy way to find it (names get all mixed up) or start it.
There's no way around webstart keeping the files in the deployment-cache: if you could specify the download-location different versions of jar-files with the same names and different codebase could end up in the same location causing no end of trouble.
I see two ways to get the wanted functionality:
Add the ability to change the local configuration as an additional function in the main application. You probably can use most of the existing code but use a method-call instead of starting it as a separate application
Create a second jnlp-file to start the configuration-program. From what you write it should be pretty small and not too much effort to create.
Related
I've been handed a JAR file, told it contains a web application, and instructed to deploy it. I'm familiar with java as a language, but I have next to no experience with its web ecosystem. Trying to run it as an executable, I find out it has no main class, so I take a look at the contents, and find that it has a META-INF/web-fragment.xml file, along with a couple of Servlet classes and some config files referenced in the xml. It looks like there is basically everything here for a complete application, but I have no idea how to actually deploy it, and google only yields tutorials on how to build these things from scratch with IDEs and deploy using maven plugins and goals.
Assuming that building from source is out of the question and I only have standard unix and java CLI tools available, based on the information provided (And I can provide more if necessary), what is the simplest way to get this up and running?
A web applicaton should be in a WAR file, not a JAR file, and you should only need to just drop it into the webapp directory of your Tomcat, or follow the instructions for whatever other container you're using.
If it's only a fragment, as appears from the XML, (a) it isn't a webapp, only part of one, and (b) you personally can't deploy it at all. You need the whole thing.
Send the assignment back for clarification.
I am quite new to working with jars and from reading online I think what I am describing is possible but I am not sure about it. If anyone has an alternative pipeline, I welcome that as well. Thanks for your time.
I would like to do the following:
I have a java program running on my machine and I would like to accept requests jars during runtime from a remote user. The users submits the jar and I would like to add the classes in the jar (which implement some predefined interfaces) to my classpath and call functions that are implemented in the submitted jar. I am using thrift as my communication platform.
How can I receive the jar file in thrift?
Once I have the jar, how do I load it? (There is no path etc because it was received from elsewhere?)
I have developed an applet, it require lots of libraries (around 5mb in .jar files), I know exactly in what pcs it will run, can I put these jars into the system in order to avoid to be downloaded each time the applet is oppened?
The system runs Windows.
The main idea for store these libs in the pc is low bandwidth.
I have tried using proguard in order to compress and reduce code size but it doesn't reduce enough, I need only to download the applet and store all libraries locally.
Thanks.
UPDATE
Tomasz Szuba answer is exactly what I was looking for.
Put all jars into jre/lib/ext/
Thanks.
It would probably be best to just rely on Java applet caching.
If you specify your applet object with multiple jars, ones that are not changed won't be redownloaded.
For example:
<applet codebase ="." code="com.applet.class"
archive="applet.jar,lib.jar,anotherlib.jar"/>
This way if lib.jar and anotherlib.jar are not changed they won't be redownloaded.
If you really must distributed those libs earlier then:
Omit those lib from archive attribute
Put those libs to extensions library folders. Instructions
Other tutorial provides way to automatically instal extension by applet an using one in it: http://docs.oracle.com/javase/tutorial/ext/basics/download.html
For more consistent and reliable caching of Jars, look to deploy the applet using Java Web Start.
I have no idea about converting EAR file into exe(Executable file), Where are i am working with jboss and i developing webservices. I want to give my product as executable file . Can anybody has idea about this.
Thank you
Gobi, you've already posted a question regarding this on 15th March, to which you've got no response. I guess you've just rephrased that same question here.
Might I suggest asking your customer/client how she would like the web service 'ear' delivered? I'm also guessing you might have database scripts, properties/config files etc. I'd put my money on 'a zip containing the ear, database scripts (if any) with related documentation'
There is no way a customer would want to 'double click' your ear and have it installed directly onto a server. If you read your Java EE spec correctly, you'd find a 'deployer' role in there. Its not there for fun. Its a very serious role whose responsibilities include 'configuring' your application.
Think about it.
You mean you want customers/users/whatever to just be able to double-click on your file, and there's a web server up and running? While that would be possible, it's not really the way most people want to run web services. They're very likely to want to run your web service within an existing container, configuring it alongside other services.
An EAR file is already designed to be pretty much droppable within a container, so that's fine. You could also supply a zip file (or an installer) with a sample container setup using any of the free container implementations - either preconfigured with some reasonable default values (e.g. for the port) or running through an installer wizard. I wouldn't spend too much time on it though - I'd assume that most people who want to run a web service will already have some experience of setting up a container, or will have specific requirements you couldn't easily capture in a wizard without a lot of work.
I don't know about making EAR as executable.
There is a editor which converts your project into setup file or installer for windows .
Hope this helps.
I used NSIS editor and recommend it and it only creates installer for windows.
HM NSIS Editor.
you may also have look at izpack
I just got a requirement to create a small (I assume standalone) utility to hit some code in our web application to do some custom processing of files from the app and then dump the files into a shared drive. My question is what is the best way for doing this? Do I just create a small app and then jar it up and run it off a command line or is there a better way?
Sorry, I didn't give enough detail. It's an old application, like over 10 years, so while it's been upgraded to jdk 1.6, most of the code uses the old collections, old loops, etc... There aren't any interfaces, very tightly coupled code that uses inheritance with lots of nested objects. The web app will do the processing. I think what they want is create some code outside of the application code that will login and then fire off the file processing code. Prior to this I had upgraded their version of Windward Reports in a separate branch and they want to make sure that the processed files: contracts, forms, etc.. don't get altered greatly as there are legal requirements on fonts and layouts. So this utility will go in, fire off the list of reports (a few thousand) dump it to a share drive so they can view them with another tool for comparision based on rules you can automate with that commercial tool, en masse. I was thinking create a small class with a main method, then jar it up and while the web server is running with my upgraded branch code, run the utility off the command line to fire it off.
There's not enough to go on here. How is the web app's functions exposed? If it's a REST interface then wget/curl/spring-rest-template are the way to go. If it's something like a JFS app then you're going to need something like Selenium to imitate a browser. If the functionality is in a shared library (JAR) then there web never even comes into play.
Well, I was originally looking at creating a standalone utility jar that I would run off the command line to connect with URLConnection to the app, but I found there is already testing code built into the application that I can run from a command line as long as I deploy the new code with the existing code. The utility will dump out the files to a shared drive and then XTest can be run to compare files. After reviewing the capabilities of XTest, it appears that it can handle the comparison of files well.