Distribute Java 8 JRE without installation? - java

Our IT policies are holding back my development efforts and we are still on Java 6. I have decided I am not going to wait anymore and move my internal customers to Java 8, so I can start improving my applications with lambdas and better code.
However they do not have admin rights over their Windows machines. Is there a way I can distribute a binary or non-installation version of Java, and invoke it with a shell/batch file with my JARs?

Thanks a_horse_with_no_name and MadProgrammer, this worked very well and production has worked great with this setup. http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html

Related

Java EE -- Configuration issues for a beginner

all. Relative rookie here who has spent the better part of three days just trying to get started with Java EE, and it's driving me up a wall. I've already read through numerous tutorials and consulted several book, so now I am turning to you.
I am starting from complete scratch, having uninstalled NetBeans and Glassfish and the Java EE SDK. My main issue is quite simply configuration. All the resources I've found typically say in a mere throwaway line: "Once you download the SDK, you must configure your environment for Java EE." But HOW? I need it in plain English. Even the most novice guides leave this basic stuff out. Does this mean editing the JAVA_HOME path or what? How does this configuration relate to the Java SE already on my system? Furthermore, I assume I don't need to also download the JDK with EE since I already have a JDK? (I am a Mac user, if that matters.)
I know I have a long, long way to go, so I appreciate any help I can get as I try to get this ball rolling. Much thanks in advance!
I think if you are using Netbeans then you don't have to worry about these things....
Simply File > New Project > Java Web > Web Application will help you get started with web applications..
Normally you would want to set the Java Home path so when you are compiling and running code your JDK is recognized. Sometimes IDEs come with their own JDK and then it really does not matter. However here is how you would set the path in different OS.
http://java.com/en/download/help/path.xml
For MAC I recommend this tutorial
http://lindaocta.com/?p=38
Make sure your JAVA_HOME is set in environment variables (just downloading SDK is not enough, you need to setup), I don't know how to do it mac, but in windows we setup my right click mycomputer-->Advanced-->Environment variables
Then install Netbeans, this step automatically searches for JAVA_HOME and assumes that SDK for all purposes. Then you are all set of programming.
If you don't mind switching to Eclipse can I recomend this tutorial An Eclipse / GlassFish / Java EE 6 Tutorial ignore the referance to Azzyzt tools and run through the tutorial step by step using GlassFish Tools Bundle for Eclipse.

Java Application Deployment/Installer Options?

I'm looking for advice on good options to deploy Java applications on end user systems.
Our end users are not tech savvy experts but casual computer users who can't be expected to figure out directories and version conflicts.
Runnable jar is not practical because we need to provide VM parameters. Batch files are not practical because for whatever reason, java.exe is not on the $PATH in a huge amount of Windows system.
Webstart is an option, but our users commonly complain that no shortcuts are created (a feature that's apparently broken), every click on the website prompts a new download, and a plethora of other issues make this option seem incredibly unprofessional to the end user.
Many of the things one finds when googleing for Java deployments are themselves built with Java, which means they won't run either on a system with a missing or broken Java installation.
If you do not want to spend any money, a popular solution is izpack.
If you're looking for a commercially supported solution, there is install4j (Disclaimer: My company develops install4j). The installer is a Java application here as well. However, it is started by a native launcher that can download a JRE bundle from your server on the fly. You can also statically bundle a private JRE. See here for more information on JRE bundles.
Webstart is an option, but our users commonly complain that no shortcuts are created (a feature that's apparently broken), every click on the website prompts a new download, and a plethora of other issues make this option seem incredibly unprofessional to the end user.
Many webstart deployments are quite unprofessional. Make sure any deployment that is showing problems is validated using JaNeLA. For the shortcuts specifically, look into the IntegrationService of the JNLP API for establishing them after launch, with feed-back.
Ultimately though, APIs will have bugs. If you find one in web start, please report it on the bug database (v. broken at the moment, but you have to try).
Many of the things one finds when googleing for Java deployments are themselves built with Java, which means they won't run either on a system with a missing or broken Java installation.
As to missing or too low version Java, use deployJava.js to ensure a suitable JRE is present. No ideas on the broken installs.
I doubt you will swing back to JWS for this immediate deployment, but please investigate it according to the ideas outlined above, for future use.

Need Help in Running My Java App

I had created a Java Swing Application, I want to run my applications, in all System, Suppose if a System, does not have JRE, then i have to install JRE using Installer in program without aware of the user knowledgeable that the JRE is installed.
There were a few projects for doing this, but from what I can see they all fizzled out - bottom line seems to be that you need a JRE - especially for swing
The best solution is not to try and install anything silently, but instead to assist the user to install Java. Oracle's deployJava.js was designed to do just that, before embedding applets or launching Java Web Start applications.
While on the subject of JWS, it is also a good choice for installing/running & updating Java rich client (e.g. Swing) apps. on platforms that support Java.
You can generate an EXE out of your Java source but you will still need the JVM to run it on the destination System. So its not real native.
There is no workaround for running non native class files reliably or really at all without the JRE.

What are the Common Practices for Java Development on Linux?

I'm trying to migrate from Windows to Linux as a Java development platform, and while the transition has generally been pretty painless, there are a few points of uncertainty that I'd like some feedback on. I'm running openSUSE 11.4, but I'm open to hear what works on other distros.
Where do you install your JDK from? This one is surprisingly not as cut and dry as most people make it out to be. OpenJDk 6 is available in the openSUSE repositories, and was very easy to install. However it's currently update 21, and right now the Oracle release is at update 24. I'm used to a little alert in Windows notifying me that my Java needs updating but that doesn't appear to be the norm in Linux. Do Java developers forgo the JDK in their package manager and install the binary directly? Or is there another way?
Where do you install Eclipse? There seems to be a general agreement online that Eclipse is best installed by simply downloading the binary and extracting it somewhere, but where's the usual place I would extract a program like Eclipse or Ant? I've seen votes for /usr/local and /opt online, but no definitive answer.
Where do you put your Jetty/Tomcat? Similar to the eclipse question, where do most Linux Java developers put their Jetty/Tomcat/other container.
What are some of the differences between the way you setup development versus production At the very least it seems I don't want to run my servlet container as root, that makes sense to me. But what other practices should I watch out for? Is there anything else that could make my development environment easier, but perhaps less secure?
I found this question was similar but ultimately too high level and didn't get into details of how actual developers are setting up their environment. If there's other resources you feel answer these questions, please share them here.
Thanks for your time.
Q> Where do you install your JDK from?
A> I never bother with other JDKs coming from outside Sun/Oracle mainly because our product is only certified to work with Sun/Oracle JRE. On my desktop, I run Kubuntu, but I never use apt-get for this but always download them manually. Reasons:
distro maintainers rarely rush to upgrade packages, as their primary concern is to make dependant apps (such as OpenOffice) work. If JDK changes from 1.6.0_20 to 1.6.0_21, they simply don't care. I might do because a newer patch might have an important bugfix or I simply want to try if my app still passes all the unit tests.
it might be a nightmare to retain old JDK versions. We still support older versions of our product and if I upgrade to a newer Kubuntu, I don't have guarantees that some ancient JDK will still be available as a package.
I am not sure some distros even support multiple existence of JDKs on the same machine.
My preference is to keep all JDKs/JREs in /opt and make a symlink to the newest one or the one I need most. I simply don't see why installing JDK manually is a problem.
I also set the PATH to the newest JDK/JRE.
Same thing (and similar arguments) apply to Ant and Maven.
Q> Where do you install Eclipse?
A> I use IntelliJ but the same applies. I store IDE in my home folder. This allows me to have different versions of it, update them without needing sudo, etc. I could as well install it in /opt but I guess I got this habit when I was downloading and testing newest IntelliJ IDEA EAP every week so I can quickly delete the older versions and do not pollute /opt. Finally, other programs might require Ant/Maven/JDK but it's only me who uses IntelliJ hence the different approach.
Q> Where do you put your Jetty/Tomcat?
A> I have a separate folder tomcats under /home where I have ~10 different Tomcat instances. Each of Tomcats is used for a different version of my app (we bundle Tomcat with our app). This is necessary because one deployment of our app can have different Tomcat settings (or even version) than another.
Q> What are some of the differences between the way you setup development versus production
A> It very much depends on your app. For example, we need some partitions to have lower access latencies but having less space (e.g. gigabytes for Lucene indexes) VS others which can have higher latencies but require more space (e.g. terabytes for content repositories). We, however, design our app so that all these different aspects can reside on different partitions which are configurable. Some partitions need to have special limitations (e.g. file upload) so this doesn't overflow other partitions. There is no simple one-for-all answer to this question, but obviously most of these concerns don't matter that much for a development environment.
Where do you install your JDK from?
I use Arch Linux myself, and we have the oracle jdk/jre in the repository itself. Hence, use your distro-repository if it has the oracle jdk/jre else get it from oracle itself.
Where do you install Eclipse?
Again, the same answer as above applies to this as well. If however, there is any issue with the distro provided version, I always put my custom installs in /opt/ - /opt/java , /opt/eclipse, /opt/netbeans - etc. I dont install stuff in my home folder (except in circumstances where I don't have permission anywhere else - rare), since that would mean that other users would need access to my home folder to run the stuff. I don't want production (or development for that matter) stuff having direct access to my home.
Where do you put your Jetty/Tomcat?
The same answer as above applies here as well. Only in circumstances, where I have installed more than one version, I create an /opt/experimental/ and install there so that I know which one my production is running and which one I can remove when no longer required.
What are some of the differences
between the way you setup development
versus production?
If possible, I always setup different machines for production and development work. Different computers, but exactly identical setup. The only systems that can push code to the production system are those in the development group. Where this segregation is not possible, I prefer to have different install for the servers, so that while I am tweaking the development configuration, my main servers don't crash or something. Also development setup will generally include a clean_up script that makes it ready for production (dropping unnecessary priviledges for db accounts, cleaning up, etc.
Have whatever, setup you will, just make sure you have different database setup for development and production purposes.
The Sun version of Java for openSUSE is on the nonOSS disk (go here and scroll down for an ISO), which is an additional disk image, not part of the main install disk ISO (or you can pull the RPMs from here).
As far as eclipse is concerned, if I'm installing at the system level, I tend to drop it in /opt. You might want to read this article on how best to handle plugins.
(Don't let them steer you off openSUSE, it is the best distro for KDE IMO.)
Working with linux is a lot less hand holding then the windows environment that you're use too. If I were you I would switch distros to either RedHat or Ubuntu, I use to use SUSE and never looked back since I switched.
You can put your JDK/Eclipse/Tomcat binaries in a couple of different places. If you are the only one going to be using them I suggest you put them in your home directory somewhere. For your Eclipse/Tomcat stuff you can but them in a local bin and then add that local bin to your PATH in your .bashrc. You can also set the location of your JDK to a JAVA_HOME env variable in your bash. If you need any more specific help with setup let me know.
1) We have had several problems with OpenJDK (bugs, etc) so we always use the sun jdk.
2/3) A good rule to live by when living in Linux, is always install your custom software under your home folder. Linux needs to be reinstalled from time to time, but everything in your home folder is in a separate disk-partition, so it lives on. I always installs/unzips custom software such as eclipse to /home/myuser/opt, so my eclipse lives at ~/opt/eclipse. I also symlinks the eclipse-binary to my /home/myuser/bin folder for easy access. When I upgrade or change any software, I just rewire the symlink.
4) Production and development environments should be as close as possible to identical. This elimenate loads of bugs caused by different configurations etc.
I create a /usr/local/java directory and unpack the JDK(s), Eclipse, Maven, Ant, Groovy and Grails in there, then create symlinks to /usr/local/bin.

Linux distros for Java Development

Simply, are there any Java Developer specific Linux distros?
A real Sun geek would chime in here about the virtues of using Solaris as a Java development platform, but I am much more ambivalent. Developing with Java is about the same on any linux distro; you are going to wind up having to install the JDK and tools of your choosing (Eclipse, Sun Studio, Tomcat, etc) so you may as well choose a distro on other criteria... perhaps how comfortable you are with it, how easy package management is, and if the look & feel suit your development habits are all big factors.
So, to answer your question more directly, a Java developer would do well with any major linux distro that they are comfortable with using in general. If you want some Java goodness out of the box, Fedora 9 and Ubuntu 8.04 have OpenJDK (and NetBeans) according to a recent announcement.
Dont listen to any of these noobs suggesting one distro over another. Java is Java and just about all distros can install java as such:
[package manager command to install] jdk
If the question was about creating RPM's, then obviously RH/CentOS/Fedora would be desirable over deb distros, source distros, or whatever other format you love. However, due to the nature of Java, a specific distro to use is only relevant if the OP cant formulate their own opinion and must follow whatever other people are doing.
To reiterate There is no java distro , use whatever will have you hit the ground running.
// begin hypocritical personal recomendation
... that being said ... I personally use Archlinux. Archlinux works on rolling releases so it is more likely to have a more recent JDK version then the "sudo apt-get dist-upgrade && sleep 6 months" distros of the world.
// end hypocritical personal recomendation
Also, I am fully prepared to get downvoted, but please, leave me above 50 so i can comment still, thanks!
Solaris :)
On a serious note, there is no Linux distro dedicated to Java, so it would be about the same.
OpenSolaris on the other hand (in my very humble experience) would be a bit faster, and you would have bonus of Dtrace as a tool. (Not that you can't find similar tools in Linux, but Dtrace should be somewhat more advanced).
I am very heavy into Java development and I personally use Ubuntu, so I agree with Sean on this one.
The package manager allows you to easily install the various SDKs (the SUN one, or even the upcoming OpenJDK 7).
Regards,
Arjen
I have used Ubuntu 8.04 and Fedora 9 with success.
For Ubuntu, the community forums were very helpful and if I remember correctly one of the repositories provided apt packages for Sun's Java6 distribution.
On Fedora 9, the Sun rpms work alright.
In either case, alternative/galternative is your friend to make sure that you point "java" and "javac" at the Sun install. I've been using Netbeans 6.1 and Eclipse 3.4 both on Fedora 9_x64 with no problems.
Just be careful with your distro's java installation. Most install gcj by default. For whatever reason, typing "java" into bash on most linux distros will not invoke a Sun JVM without some futzing.
Usually, there needs to be a bunch of soft-linking from /usr/local/bin -> $JDK_HOME/bin/* to get things working as I typically expect them.
I think the motive for this question is focused on the convenience of setup: Is there any distro that has Eclipse and the full Sun Java package (JRE, JDK, and DOCS) already "baked in" so that a manual install process (and deinstall of OpenJDK) is not required?
Having an "out-of-the-box" standardized environment for a development team is a huge time saver. If you don't already have access to a Java-experienced Linux SysAdmin to guide you through the process of rolling your own automated install, learning enough to do it yourself is definitely frustrating.
Few Developers enjoy spending their time wrenching around with OS internals to get tools like Glassfish, Derby, Groovy, Grails, GWT, etc. all working together. They prefer to go directly to writing code and inventing stuff inside a personal sandbox that exploits a pre-existing ecosystem of built-in services...
On the deployment side, having a common Linux install that requires no system-level configuration for end-users except for installing their favorite Java applications' .JAR file would be another big win.
There's definitely a market for someone to provide this, but most folks are simply gritting their teeth and doing it for themselves.
Either SUSE or RH, both have official support.
http://www.java.com/en/download/help/5000010500.xml
I have never heard of a Java-developer-specific Linux distro.
If you need a Linux distro for work purposes (not for personal home use) then the choice of distro is not really affected by the fact that you need to install a JDK, but other factors:
how quickly can it be installed?
how easy is it to maintain (updates etc)?
how fully-featured is it out-of-the-box?
how well supported is it? (commercial support if you need it, otherwise how good is community support?)
My suggestions for work-purposes: Ubuntu and Suse have been good for me. I have no experience with the others mentioned (eg: Fedora).
Basically, get a distro that "just plain works". Everything you need (JDK, IDE, etc) will almost certainly be easily installed from there.
I had a pleasant experience with Mandriva power pack 2008. Select something like development->"java tools" and everything is installed for you.
Everything being Sun JRE, JDK, and eclispe.
Solaris did install a 64bit kernel by default though.....
Latest Ubuntu version. It is easy enough and have packaged Sun Java, Eclipse, NetBeans, GlassFish, TomCat and other Java development related software so you have no worries installing and configuring it from scratch.
You can choose any of the distro available bcoz dere is no linux distro specifically for java development. Personally I have worked on RHEL 5, Fedora 9, Mandriva with considerable success.
Working on java is same on any linux distribution after the installation of jdk, tomcat, eclipse, etc.
As Nick Stinemates mentioned, Gentoo is an excellent distro for developing Java. It is one of the few Distros that I know of that has a very active Java maintainer group and almost everything that people use regularly is already packaged.
Be warned, Gentoo is not a drop dead simple distro to use Ubuntu -- you have to understand a bit about how the OS works -- but it does provide an excellent developerment environment.
The distro which is most developer friendly, in my opinion, is Gentoo. Since you compile everything from scratch, you choose exactly what makes up your system. Java can be installed very easily, so you could potentially just have a window environment and Java installed (aside from the standard tool chain.)
For a start: most -if not all- linux distribution allow you to "easily" install (that is: using the distribution's package manager) jdk's and jre's. The choice essentialy is more about what aspect of the distribution is most relevant to your personal taste.
Personnaly, I've come to value overall distribution stability (as in: upgrades to the base system are more or less guaranteed-not-to-hose-my-workstation-one-day-before-delivery-date) more, which made me stick with debian for the past few years.
The price to pay for that is either "sudo apt-get dist-upgrade && sleep 6 months" as theman_on_vista points out, or just install relevant stuff yourself in /opt. After all, installing some jdk's, maven or ant and eclipse|netbeans is easy enough (hell, there even is documentation somewhere I'm sure :) )
Oracle JVM from their website is going to have the same speed on debian, archlinux and slackware (and probably their derivatives). Your best bet is to tweak the JVM arguments for the web servers/IDEs you might be using. Remember that java for x64 architectures will consume more memory due to larger native pointers, so you would do well to tweak your heap size accordingly. Especially if you don't want your server to stop with an OutOfMemoryError exception.
if you use ubuntu or other debian family you can try this command
sudo apt-get install default-jdk default-jre
While not really a distribution, there is a virtual machine available for Tomcat. It could be adapted pretty easily for other Java based deployments (available for several virtualization technologies).
There are also several Java App Server VMs available from VMWare (VMWare only, of course).

Categories