Install automatically Java 8 on Windows Server AMI - java

I am starting a Windows Server AMI and would need to have java 8 installed after boot. I already have an instance-setup.txt script to install the codedeploy-agent automatically (from here: http://docs.aws.amazon.com/codedeploy/latest/userguide/how-to-set-up-new-instance.html), but would need to install Java 8 at the same time. I have no idea how to automatize this though, did anyone manage to do it successfully by any chance ?
Thanks !
Emmanuel

The Java installers for Windows provide the ability to run an installation in silent mode via the command line or a script. If you package a Java installation executable with your deployment you can run a silent install like this:
jre-8-windows-i586.exe /s
Check out the documentation on Windows Installer Options for Java for more information and other available options: http://docs.oracle.com/javase/8/docs/technotes/guides/install/windows_installer_options.html

Related

Running Jenkins Node/Agent as a Windows Service with OpenJDK

I have a Windows virtual machine with OpenJDK 13 installed that I would like to setup as a Jenkins node/agent.
When I create the node configuration using the Jenkins UI and select Launch Method: Launch Agent by connecting it to the master it provides a link to download slave-agent.jnlp
On a system with the original jdk/jre older than version 9, which contains java web start, if I run that jnlp file, it brings up a window with a menu that includes an option File - Install as A Service
However, as OpenJDK (and I believe any JRE/JDK versions greater than 8) do NOT contain Java Web Start, I cannot seem to gain access to that option.
I am able to successfully run java -jar agent.jar -jnlpUrl https://jenkinsserver/blah/slave-agent.jnlp -secret blah -workDir "somedirectory" and have the node register with Jenkins, but it is not running as a service.
I had an older agent that was still using old version of JRE, so I looked at its Jenkins service configuration and unfortunately it seems to be relying on executable(s), .config file(s), and xml file(s), which I cannot determine the source of, beyond they must be created when running the "Install as a service" instructions from slave-agent.jnlp
I also attempted to use IcedTea-Web which is apparently supposed to be a Java Web Start replacement, but I've had no success.
Can anyone tell me how to setup a Windows machine running OpenJDK as a Jenkins node/agent with the Jenkins node/agent components running as a Windows service?
I had a similar issue and now I use NSSM.
Download NSSM
Open a cmd and install the service (I used JenkinsService as Servicename):
<path to nssm.exe>\nssm install <Servicename>
Insert the path to the jdk to the field Path
add the rest to the field Arguments:
-jar agent.jar -jnlpUrl https://jenkinsserver/blah/slave-agent.jnlp -secret blah -workDir "somedirectory"
Click on install the service
Now you can check the new service JenkinsService in the windows service manager. As soon as it's running you can check the connection to the master.
If you want to setup a Java base application as a service, I believe the best option would be to use Procrun from Apache. It is the exact method that Tomcat uses.

The program 'jshell' is currently not installed when trying to run jshell on Ubuntu

I have downloaded and "manually" installed JDK 10 for Linux 64bit edition (for Ubuntu 16.04),
Oracle Java SE Development Kit
(note: I wanted to download the Java9 JDK but this is no longer supported and I was referred to the Java 10 SE Development kit instead).
When I try running jshell from a terminal window I get the following error,
The program 'jshell' is currently not installed. To run 'jshell'
please ask your administrator to install the package
'openjdk-9-jdk-headless' You will have to enable the component called
'universe'
I dont know why the message is asking me to install openjdk when I have installed the classic java version. When I run "which jshell" I dont get any details returned.
Can anyone help me get jshell installed and working ?
JShell is a development tool. You should download and install the Java Development Kit to run jshell, not just the Java Runtime Environment.
On Linux, and specificallly Ubuntu, development tools are not best installed via apt. The exception to prove the rule is RVM, which is installed via apt purely so that it will download ruby and ruby gems dynamically outside of apt.
For Java, the equivalent is SDKman, which is installed via curl. Once you have SDKman then you can install Java and other Java type tools.
SDKman in action:
thufir#dur:~$
thufir#dur:~$ sdk list java
================================================================================
Available Java Versions
================================================================================
12.ea.20-open
11.0.1-zulu
> * 11.0.1-open
10.0.2-zulu
10.0.2-open
9.0.7-zulu
9.0.4-open
* 8.0.192-zulu
8.0.191-oracle
7.0.201-zulu
6.0.119-zulu
1.0.0-rc-10-grl
1.0.0-rc-9-grl
1.0.0-rc-8-grl
================================================================================
+ - local version
* - installed
> - currently in use
================================================================================
thufir#dur:~$
Generally, umake, or Ubuntu Make, will install IDE or other development tools. Currently, umake is best installed as a snap.
The upshot is to first install SDKman, then snap, then use snap to install umake. Between umake and SDKman your tools should be up to date.
(Ruby uses a similar RVM, which inspired SDKman.)
I followed the tip given by Ernest Kiwele and others above and set-up my JAVA_HOME partly as described in
How to set JAVA_HOME in Linux for all users
but also by creating a sh script in my profile.d directory. Thank you for the help.
I dont feel completely comfortable with my solution since I have configured my Java using update-alternatives. I dont know why people advise to use update-alternatives to set the version of Java to use if the other depending variables aren't set-up at the same time.

How to solve error java.lang.NoClassDefFoundError at the time of installing netbeans8 in debian

I am trying to install netbeans 8 in debian-7.0-amd64-minimal. (VPS)
1st I have installed java/JDK latest version (1.8.0_20) by following
https://www.digitalocean.com/community/tutorials/how-to-manually-install-oracle-java-on-a-debian-or-ubuntu-vps
Next I am trying to install netbeans by following
http://installnetbeansdebian.blogspot.com/2013/06/how-to-install-netbeans-73-ide-complete.html
when I run
./netbeans-8.0-php-linux.sh
it displays the following error.
Configuring the installer...
Searching for JVM on the system...
Extracting installation data...
Running the installer wizard...
Exception: java.lang.NoClassDefFoundError thrown from the UncaughtExceptionHandler in thread "main"
Anybody knows, how to fix this?
Had a similar issue, for some reason the command
$ sudo chmod -x netbeans-8.2-javaee-linux.sh
didn't create executable file out of the script, so I had to use GUI method, as it shown here in the second answer:
https://askubuntu.com/questions/229589/how-to-make-a-file-e-g-a-sh-script-executable-so-it-can-be-run-from-termina
then as the user Firestorm suggested just dropped sudo and it worked for me:
$./netbeans-8.2-javaee-linux.sh
Installed perfectly even created "Development" department in the "Application" menu and nested program start tag there. Debian-8 x64 KDE
Just had the same issue here (Fedora 25, Netbeans 8.2). It only occurs, when executing the installer as root which seems to be a problem with a root-privileged gui in a non-root-privileged environment.
Solution: Either install netbeans as normal user in your home directory OR launch the installer as root with the switch '--silent':
./netbeans-8.2-html-linux-x64.sh --silent
which will install netbeans in /usr/local.
Maybe late. For ubuntu 17
azuka$ : xhost +
azuka$ : sudo su
root$ : sh netbeans-8.2-php-linux.sh
I had the same issue on "Fedora 26". But I resolved it by repeating the same procedure but not as 'root' or 'sudo'. I.e:
Change directory to locate the downloaded file.
then.
$ chmod +x netbeans-8.2-linux.sh
$ ./netbeans-8.2-linux.sh
This question is nearly exactly two years old, but still actually occurred here just now.
I had this too on a Slackware system. I was trying to install it like you (because Slackware doesn't provide NetBeans packages) and I was typing in a virtual terminal window after executing su. The problem was the exact same as yours: I got the NoClassDefFound exception and the installer stopped. The solution was to execute the NetBeans installer as a normal user, or as the same user that you're logged in as in the X session. Java errors can be a bit cryptical, but the solution's as easy as that.
I hope this helps.
Simply close netbean if you open it already
1.install openjdk
2. download netbean
and where you download it use below command
$./netbeans-8.2-javaee-linux.sh
The solution was to execute the NetBeans installer as a normal user, or as the same user that you're logged in as in the X session
The solution was to execute the NetBeans installer as a normal user, or any user other than root.
define JAVA_HOME and JDK_HOME as environment variable
I had the same issue while installing Oracle Developer Studio via ssh X forwarding. I switched jdk from SE to 1.7.0 openjdk (update-alternatives --config java) and then managed to install. I hope it will help someone.
I have the same issue and I use:
sudo bash -x Apache-NetBeans-12.1-bin-linux-x64.sh --silent
and with this I coud install netbeans, but the version 12.1.
It is much easier (and more reliable and more secure) to use package management system to install software. All you need to do is to use the following command to install netbeans on Debian:
sudo apt-get install netbeans
Although netbeans version 7 will be installed (ver. 8 is not available from native Debian repository yet) you won't be struggling to make it work.
Besides please be careful with instructions to install java/JDK -- the method they describe is not the best. If OpenJDK is not sufficient for you then you might be doing something wrong. If you absolutely have to try Oracle's Java (unfortunately there are some corner cases when it might be needed) please use java-package to build your own Java package (.deb) from downloadable Java binary.

Installing JDK from self extracting bin on Cygwin

I want to install the JDK in cygwin on my windows machine. I am downloading the linux version of JDK from oracle site using wget command. Here is the list of commands I am running to install JDK:
wget http://download.oracle.com/otn-pub/java/jdk/6u31-b04/jdk-6u31-linux-x64.rpm.bin
chmod a+x jdk-6u31-linux-x64.rpm.bin
./jdk-6u31-linux-x64.rpm.bin
All these instructions are same as suggested by Oracle for installing JDK over here but I am getting the following errors:
Firstly, those messages indicate that what you are trying to execute is an HTML document! In other words, the download has failed and given you an error page rather than an installer.
However, assuming that you succeed in downloading the (Linux) installer, it is unlikely that it will install properly, and there is about ZERO chance that the installed tools will run. Applications that have been compiled for Linux don't run on Cygwin.
What you need to do is to download and install the JDK for Windows, and then tweak your cygwin profile a bit. This page explains: http://horstmann.com/articles/cygwin-tips.html.
(If you Google for "java cygwin" there are various other tips for making Java work from Cygwin. However, in my experience there are a few rough edges ... due to the fact that the Windows Java utilities expect to have been called with windows-style arguments, pathnames, classpaths, etcetera.)

Check whether cygwin is installed & install if needed

I am trying to run shell scripts in Windows XP using Java. I found that we can run shell scripts using cygwin in Windows, but what if it is not installed on the system?
I want to check whether it is installed on machine, if it is not installed - add that software as a part of my application and install it.
If cygwin complains with windows installer standards then when you install it you should be able to find a registry entry for this program.
You should check the registry for something like localmachine/software/cygwin.... this validation can be done using RegistryKey class in c#.
To include this program as a dependency you must provide the way you are installing your app, visual studio windows installer? Inno installer?

Categories