Java Deployment - java

When deploying a Java application, can I assume that every computer has java, and so is able to run my application? I've just created a java app, which works on my computer, but my boss (who generally uses .NET) claims it doesn't work at all. Should I assume that this will happen often, or will most consumers have java?

I think it is better to NOT assume that all computers have JRE installed. Just like development practice you need to have a deployment strategy for your application.
Here are some of the questions you need to find answers to arrive at a better deployment strategy:
Which version of JRE is needed, what if the computers on which the application is run has an older version of JRE ?
What all platforms (windows, linux or both ) your application is going to be run ?
Is there a IT policy that ensures that a standard version of JRE is available on all the hosts ? In this case
you can make a valid assumption that all computers on which application is run has the JRE installed?
If you need a specific version of JRE which is not available on all the computers may be you have to bundle the
JRE along with your application.

I think that you should provide to your users a way to download/install the jre (probably a link) with a friendly message explaining the need to install it.
Java is widely use.
NOTE In example, following is an example of the applet tag:
<applet code=Applet1.class width="200" height="200">
Your browser does not support the <code>applet</code> tag.
</applet>
If you are deploying your application in a traditional way, there are some java application installers that handle it for you.
I hope it helps you.

You can also deploy a jre along with your application. Many 3rd party applications do this to ensure that the proper version of Java is available on the system. There are pros and cons with each approach.
You will want to refer to the license information about redistributing the jre contained in the jre folder ( e.g C:\Program Files (x86)\Java\jre6\README.txt - or wherever your install is ) to ensure you follow the proper procedures.

There are a number of solutions. You should not assume that everyone has Java installed. You can use web start for instance which will help with the setup. You can find some advice here.
More info about web start here.

Related

Can I copy the Java Runtime Environment to other Computers?

I have the following problem:
I wrote an application in java for my company. Now i have the problem that not every user has the jre installed on his pc. And due to company guidelines its not that easy to install it on every computer.
My question is: Can I write a batchfile which checks if the jre is already installed and if not copies the jre onto the computer? Would the jre work if I just copy it?
If you have another solution for my problem feel free to tell me.
Thank you for your answers
Bundling a Java desktop application with a JRE is in fact nowadays considered good practice. How exactly to do that depends on the target operating system. But there's usually no need to come up with an individual solution as Oracle provides instructions on how to achieve this in a standardized way.
This is what Oracle says about the basics of "Self-Contained Application Packaging":
Each self-contained application package includes the following items:
Application code, packaged into a set of JAR files, plus any other
application resources (data files, native libraries)
Copy of the JRE, to be used by this application only
Native launcher for the application, multiple launchers for a single
package are supported
Metadata, such as icons
They provide detailed instructions for Java 8 and Java 9 on how exactly to create the package for different operating systems.

Multiplatform standalone Java application with JVM included

is there a way to execute a jar on different OS (linux/windows) that could be not installed jvm on?
I take a look on lunch4j but it make a search of jre on OS. This isn't my case.
Tnx
alot
1. Check following Stack Overflow answers (and its many duplicate links) Compiling a java program into an executable. You should find suitable tools that will allow you to create an easy to deploy form of your application, e.g. *.exe for Windows with all the necessary run-time libraries optionally included.
2. For inspiration of how such deployment might work (either run through the web browser click or easy to download/run installer) check yWorks yED. If you like their way you may send them an "share your know how" e-mail

IBM Java on Linux

What would be the use case of installing IBM Java on a Linux machine? We tested our application on Linux using Oracle Java but one of ours customers installed it on a machine which only has IBM Java and the application gives errors for some missing classes and jars.
I'm assuming that the IBM java would probably have been installed because some IBM products mandate use of IBM java but this should not be a deterrent to install Oracle Java in addition to IBM java. Is my understanding correct?
Please share your thoughts.
I believe IBM doesn't ship its Java as an independent package -- so, yes, if IBM Java is present it's because an IBM product was installed that came with the IBM Java environment. (IBM supports Java on some platforms Sun doesn't; I believe the reverse is also true -- I don't think IBM bothers producing its own Java for Solaris, for obvious reasons.)
There's no problem having multiple Java's installed, each in its own directory. In some Linuxes, the alternatives mechanism can be used to select which Java is the default when you type java at the command line; in others, you would have to manually change the path or adjust symbolic links appropriately (the later is what alternatives does semi-automagically).
If you're working in Eclipse, its configuration menus will let you pick which installed copy of Java it will use to execute/debug applications, either on a workspace-default level or per launch.
(I have something like eight JREs/JDKs installed on my Red Hat machine -- a mix between Sun and IBM. Some are for my own use, for testing code for compatibility or trying to reproduce customer bug reports. Some were installed because a particular tool shipped with its own JRE rather than risk possible incompatabilities with another version; that's the only reason I still have a Java 1.5 JRE installed, for example. It's an annoyance, and it slightly belies Java's original promise of "write once, run everywhere", but it does work.)
There is nothing stopping you from having multiple installs of Java on a single linux system. However when running your application, you need to make sure that you are using the oracle version of java and not the IBM version.
which java
and
java --version
can help you find which version of java you are using.
Java is usually installed under /usr/lib/jvm or something similar to that. Checking there can help you find which java installs you have available.
You are correct that IBM java comes with IBM product installation - IBM does not ship their Java as standalone product. However, they provide provision to download their JRE for Linux from developerworks.
Ideally product running on Oracle JRE should run on IBM JRE and vice versa. However, to ensure that each product on the system runs on the JRE they are tested on, set java home properly for respective products. In case both the products use the same system-wide environment variable (which should not be the case anyway) - you may need to tweak your product settings so it does not break any IBM product running on the system.
As long as you properly isolate multiple JREs as used by different products through product/system property settings, there should not be any issue.

Installer for Java Desktop Application

I am developing an inventory system i-e a java desktop application. I am using Ms Access as database engine and there are certain modules e.g one makes reports using ireport and other such dependencies. I need to ask how can I make installer for my application which will install few fonts, copy database files, install jre to make it run etc. Please guide me in it.
Thanks in anticipation.
This is something I've briefly used in the past, and it may serve your needs. It's an open source installer builder system, tailored towards Java apps.
http://izpack.org/
I've used jsmooth which creates a single EXE-file that unpacks and run transparently. Not a full installer but worked well for us.
Note: I have not seen any Java installers which asks the "There is an update available. Update now?" question.
If this is important to you, then consider Java WebStart which checks for updates at each launch (but do not ask).

Recommendations for Test Linux/Web Server Environment using Java

I'm a .NET developer looking do some research on my own time to better familiarize myself with Linux and Java (e.g JSP and Servlets).
My plan is to install Linux on an old PC. Then, install and configure a web server capable of hosting JavaServer Pages and Servlets. I would like to create a small web site with dynamic content being pulled from a database. Again, this site is only intended to be used by me for research and testing.
I have very little experience with Linux and Java. Did a couple projects back in college, but that was over 8 years ago.
Below are the questions I have about configuring a test environment I can use for research and testing.
1) What version of Linux should I install on my old PC?
2) What web server should I install on my Linux machine that can be used to host JavaServer Pages and Servlets?
3) What database should I install on the Linux machine? Since I'm doing this for research, it would be nice to test with a DBMS that is commonly used in the real world.
Thanks,
Chris.
You can use Debian, Tomcat and MySQL.
Debian is a fairly common linux distribution and will work on almost every PC.
Tomcat is a simple servlet container. It's the best choice if the only thing you want to do is servlets and JSP.
MySQL is, well MySQL :)
If you do mind using Linux, you can use Ubuntu which is more user-friendly but not really recommended as a server (at least for the default version).
These applications/distributions are from the most used and with the most active communities.
Resources :
debian.org
tomcat.apache.org
mysql.com
ubuntu.com
Whichever you want :-) At work, for example, our Linux servers run Red Hat Enterprise Linux, which is loosely based on Fedora, so that might be a good distribution to use that might be similar to what you would experience in the 'real world'.
Tomcat or JBoss Application Server would be good app servers to start with. Tomcat is just a servlet container, whereas JBoss supports more of the Java EE technologies. That said, many organisations find that a 'lightweight' app server like Tomcat is perfectly adequate.
MySQL and PostgreSQL are both widely-used open source database servers.
I would install the latest Ubuntu. The most user friendly and should work on your old PC.
I would install Glassfish or JBoss. Glassfish comes with Oracle's Java EE and is the easiest to install. JBoss is more widely used in commercial settings. Better yet, install both and try it on both!
MySQL is easy to install on Linux machines. In fact it's usually installed by default by the distribution.
Good luck! Linux is a great learning experience and a lot of fun!
I'm not a specialist in linux distributions, but as webserver the apache tomcat would be the best choice, I think version 6. The database may be a mysql, but for professional usage with more functionality postgresql will be the best choice.
Slackware. You will get lots of different answers on what distribution to use, and a lot of it is personal preference. I always prefer Slackware for server installations, and install all my software from source. I think of Ubuntu and Redhat more as client/desktop installations. I don't like to rely on packages to keep my servers up-to-date.
Tomcat. You don't need J2EE. Tomcat will do the job nicely.
MySQL. It's quite standard and works well.
1) As you want, but I suggest you a Red-Hat (CentOs for example) or Debian (Ubuntu for example) based distribution. With respectively Yum/RPMs and Aptitude/Synaptic, it will be easier to install Java (even if it is not difficult on other distributions).
2) To serve JSP pages and execute servlets, I suggest you Tomcat. It is much easier to install/configure it than other webservers (JBoss, Websphere, Weblogic, etc.), and you won't need them in a first time (EJB, etc.)
3) As a database, you can use MySQL (very easy to install), or PostgreSQL, or Oracle Express Edition (not Open Source but Free... And Oracle is very often used on big projects). From a Java point of view, it will be very similar (JDBC/Hibernate access to database "hide" the specificity of DB)
I think you are starting in the wrong place.
1.
If you want to try out linux try out linux. You don't need to install it - just download a "live CD". I believe the latest Ubuntu installer comes on a live cd.
2.
If you want to try out java web development you don't need to set up a server just install eclipse for java ee and create a dynamic web project. Then just start developing. Try to find some tutorials, etc. Eclipse can even download a development tomcat from within the ide.
3.
For databases - why not just use the same database you use with .net? I am sure there will be a jdbc driver and the code you write shouldn't be that different from any other database.

Categories

Resources