java

warning: Creating default object from empty value in /data/web/1/000/027/003/273448/htdocs/panticz.de/modules/taxonomy/taxonomy.pages.inc on line 33.

Glassfish

http://download.oracle.com/glassfish/4.1/promoted/index.html

# parameter
grep pass /etc/init.d/glassfish
ASADMINOPTS="--user admin --passwordfile /opt/glassfish/pass"

Jenkins: install and configure JDK

# download and extract JDK
URL=http://download.oracle.com/otn-pub/java/jdk/8u25-b17/jdk-8u25-linux-x64.tar.gz
wget --continue --no-check-certificate --header "Cookie: oraclelicense=a" ${URL} -O /tmp/${URL##*/}
tar -C /var/lib/jenkins/tools/hudson.model.JDK/ -xzf /tmp/jdk-8u25-linux-x64.tar.gz

# configure JDK
http://192.168.1.111:8080/configure
JDK
JDK installations
Add JDK
Install automatically: check out
JAVA_HOME: /var/lib/jenkins/tools/hudson.model.JDK/jdk1.8.0_25
Save

# create New Item
Item name: JDBCTest
check "Freestyle project"
JDK: JDK8

Tomcat configuration

wget https://raw.githubusercontent.com/panticz/installit/master/install.tomcat.sh -O - | bash -

#!/bin/bash

# ensure that this script is run by root
if [ $(id -u) -ne 0 ]; then
  sudo $0
  exit
fi

# install Java JDK
wget -q https://raw.githubusercontent.com/panticz/installit/master/install.java-jdk.sh -O - | bash -

# install tomcat
apt-get install -y tomcat8

# OPTIONAL: configure JAVA_HOME
echo "JAVA_HOME=/usr/lib/jvm/$(ls /usr/lib/jvm | grep oracle | tail -1)" >> /etc/default/tomcat?

# configure tomcat to linsten on port 80 instead of default 8080
sed -i 's|port="8080"|port="80"|g' /etc/tomcat?/server.xml

# bind to a privileged port
sed -i 's|#AUTHBIND=no|AUTHBIND=yes|g' /etc/default/tomcat?

# restart tomcat
service tomcat8 restart

# start
export JAVA_HOME=/usr/lib/jvm/jdk1.6.0
export JAVA_OPTS="$JAVA_OPTS -Xmx256m"
/usr/local/apache-tomcat-5.5.20/bin/startup.sh

# deploy
/opt/SDK2/bin/asadmin deploy /tmp/Intranet.war

# change default port from 8080 to 80

# log directory
/var/log/tomcat6

# redirect by default to a app
mv /var/lib/tomcat6/webapps/ROOT/index.html /var/lib/tomcat6/webapps/ROOT/index.old.html
cat < /var/lib/tomcat6/webapps/ROOT/index.html

EOF

# manager
http://YOUR_TOMCAT_IP/manager/html/

# apache module
mod_jk

# LINKS
http://wiki.ubuntuusers.de/Tomcat
http://linux-sxs.org/internet_serving/c581.html
http://shrubbery.mynetgear.net/c/display/W/Disable+Directory+Listing+in+Tomcat
http://wiki.ubuntuusers.de/Tomcat

# https://intranet.sedo.de.intern/confluence/pages/viewpage.action?title=Enable+SSL+in+Tomcat&spaceKey=SOA
# https://ssl-trust.com/ssl-zertifikat-installieren/tomcat
# http://www.torsten-horn.de/techdocs/ssl.htm

Install Sun / Oracle Java JDK under Ubuntu

wget -q --no-check-certificate https://raw.githubusercontent.com/panticz/installit/master/install.java-jdk.sh -O - | bash -

#!/bin/bash

# ensure that this script is run by root
if [ $(id -u) -ne 0 ]; then
  sudo $0
  exit
fi

# install debconf
apt-get install -y debconf-utils

# create answer file
debconf-set-selections <<\EOF
oracle-java8-installer shared/accepted-oracle-license-v1-1 select true
EOF

# ensure that add-apt-repository is installed
. /etc/os-release
if [ "${ID}" == "debian" ] && [ "${VERSION_ID}" == "7" ] ; then
  # Debian Wheezy
  apt-get install -y python-software-properties
else
  # Ubuntu and Debian Jessie
  apt-get install -y software-properties-common
fi

# add repository
add-apt-repository -y ppa:webupd8team/java

# fix distribution name on Debian
for FILE in $(find /etc/apt/sources.list.d/ -name "*webupd8team*.list"); do
  sed -i 's|wheezy|precise|g;s|jessie|trusty|g' ${FILE}
done

# update repository
apt-get update -qq

#  bypass the apt-cacher-ng proxy
echo 'Acquire::HTTP::Proxy::download.oracle.com "DIRECT";' > /etc/apt/apt.conf.d/99_oracle

# install
apt-get install -y oracle-java8-installer

# set Java environment variables
apt-get install -y oracle-java8-set-default

# set java 8 as default java version
update-java-alternatives -s java-8-oracle

# move java desktop symbols
[ -f /usr/share/applications/JB-mission-control-jdk8.desktop ] && sed -i 's|Categories=Development;Java;|Categories=Application;Network;|g' /usr/share/applications/JB-mission-control-jdk8.desktop

Install JDK under Debian 7 (minimal)
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" > /etc/apt/sources.list.d/webupd8team-java.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
echo 'Acquire::HTTP::Proxy::download.oracle.com "DIRECT";' > /etc/apt/apt.conf.d/99_oracle
apt-get update
echo "oracle-java7-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections
apt-get install -y oracle-java7-installer
apt-get install -y oracle-java7-set-default

Download JDK manually
# v7
URL=http://download.oracle.com/otn-pub/java/jdk/7u71-b14/jdk-7u71-linux-x64.tar.gz
# v8
URL=http://download.oracle.com/otn-pub/java/jdk/8u77-b03/jdk-8u77-linux-x64.tar.gz
# download
wget --continue --no-check-certificate --header "Cookie: oraclelicense=a" ${URL} -O /tmp/${URL##*/}

# http://download.oracle.com/otn-pub/java/jdk/8u77-b03/jdk-8u77-linux-x64.tar.gz?AuthParam=1458983739_a16ec49d4ccc02fd689b10ad958ab0ce

# fix repo key
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886

OPTIONAL: Uninstall OpenJDK
sudo apt-get remove -y openjdk-7-jre-headless

Display your current java version
java -version

Links
http://www.webupd8.org/2014/03/how-to-install-oracle-java-8-in-debian.html
http://www.webupd8.org/2012/11/oracle-sun-java-6-installer-available.html - HowTo, install Java under Ubuntu and Debian
https://launchpad.net/~webupd8team/+archive/java - webupd8team Java repository
https://www.thomas-krenn.com/de/wiki/Oracle_Java_JRE_unter_Ubuntu_installieren

Java: Add autocompletion to a (editable) JComboBox

1. Download this source code and add to your Java project:
http://www.orbital-computer.de/JComboBox/source/AutoCompletion.java

2. Add folowing code to enable autocompletion for your JComboBox:
AutoCompletion.enable(yourComboBox);

For further information about JComboBox and AutoCompletion see:
http://www.orbital-computer.de/JComboBox/
https://today.java.net/pub/a/today/2007/07/19/adding-auto-completion-to-swing-comboboxes.html

installSqlDeveloper.sh

Get Oracle SQL Developer package
1. go to Homepage: http://www.oracle.com/technology/software/products/sql/index.html
2. accept the licence
3. login
4. download "Oracle SQL Developer for other platforms"

http://download.oracle.com/otn/java/sqldeveloper/sqldeveloper-4.1.0.18.37-no-jre.zip

wget https://raw.githubusercontent.com/panticz/installit/master/install.sqldeveloper.sh -O - | bash -

#!/bin/bash

if [ -z "$1" ]; then
  echo "Please enter the url to download"
  exit
else
  URL=$1
fi

FILE=${URL##*/}
[ -n "$2" ] && USER=$2

# install Java JRE
wget -q https://raw.githubusercontent.com/panticz/installit/master/install.java-jdk.sh -O - | bash -

# get file
if [ ${URL:0:4} == "http" ]; then
  wget -q ${URL} -O /tmp/${FILE}
else
  cp ${URL} /tmp/${FILE}
fi

case ${FILE: -3} in
rpm)
  # convert rpm package to debian
  sudo apt-get install -y alien
  sudo alien /tmp/${FILE}
  sudo dpkg -i /tmp/${FILE/.rpm/.deb}
  ;;
deb)
  # install debian package
  sudo dpkg -i /tmp/${FILE}
  ;;
zip)
  # extract
  [ -d /opt ] || sudo mkdir /opt
  sudo unzip /tmp/${FILE} -d /opt/
  sudo chmod +x /opt/sqldeveloper/sqldeveloper.sh
  ;;
*)
  echo "Unknown file format"
  exit
  ;;
esac

# fix "Error: SQL Developer can't recognize the JDK version" error
sudo sed -i '1a unset GNOME_DESKTOP_SESSION_ID' /opt/sqldeveloper/sqldeveloper.sh

# create startet
cat << EOF | sudo tee -a "/usr/share/applications/oracle-sql-developer.desktop"
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=Oracle SQL Developer
Type=Application
Terminal=false
Exec=/opt/sqldeveloper/sqldeveloper.sh
Icon=/opt/sqldeveloper/icon.png
Categories=Application;Development;
EOF

# create user config to the latest installed JDK version
[ -d /home/${USER}/.sqldeveloper ] || mkdir /home/${USER}/.sqldeveloper
[ -f /home/${USER}/.sqldeveloper/jdk ] || echo "/usr/lib/jvm/$(ls /usr/lib/jvm | grep oracle | tail -1)/" > /home/${USER}/.sqldeveloper/jdk

# set owner
chown -R ${USER}:${USER} /home/${USER}/.sqldeveloper/

# cleanup
rm /tmp/${FILE}

# reduced memory usage
sed -i 's|-Xmx640M|-Xmx384M|g' /opt/sqldeveloper/ide/bin/ide.conf

# ToDo
# http://download.oracle.com/otn/java/sqldeveloper/sqldeveloper-4.0.2.15.21-1.noarch.rpm?AuthParam=XXX_XXX
# use a repository
# configure global

Install Java JRE

wget https://raw.githubusercontent.com/panticz/installit/master/install.java-jre.sh -O - | bash -

#!/bin/bash

# no JRE package available, use JDK package
wget -q --no-check-certificate https://raw.githubusercontent.com/panticz/installit/master/install.java-jdk.sh -O - | bash -

Download Oracle Java JRE & JDK using a script
https://ivan-site.com/2012/05/download-oracle-java-jre-jdk-using-a-script/

Fix mozilla java plugin
JAVA_HOME=/usr/lib/jvm/jdk1.7.0
MOZILLA_HOME=~/.mozilla
mkdir $MOZILLA_HOME/plugins
ln -s $JAVA_HOME/jre/lib/i386/libnpjp2.so $MOZILLA_HOME/plugins
or
ln -s $JAVA_HOME/jre/lib/amd64/libnpjp2.so $MOZILLA_HOME/plugins
or
ln -s /usr/lib/jvm/java-7-oracle/jre/lib/amd64/libnpjp2.so ~/.mozilla/plugins/

Links
http://wiki.ubuntuusers.de/make-jpkg
https://github.com/flexiondotorg/oab-java6 - Create a local apt repository for Sun Java 6 and/or Oracle Java 7 packages.
http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html
http://www.webupd8.org/2011/03/install-java-in-ubuntu-1104-natty.html
http://www.sysadminslife.com/linux/howto-oracle-sun-java-7-installation-unter-debian-6-squeeze/

Install MS SQL Server JDBC Driver

# get driver
#URL=http://jaist.dl.sourceforge.net/project/jtds/jtds/1.2.5/jtds-1.2.5-dist.zip
URL=http://jaist.dl.sourceforge.net/project/jtds/jtds/1.3.1/jtds-1.3.1-dist.zip
wget ${URL} -P /tmp/
unzip /tmp/jtds-*-dist.zip -d /tmp/
sudo cp /tmp/jtds-*.jar /usr/share/java/

Eclipse > Build Path > Configure Build Path
Libraries > Add External JARs
/usr/share/java/jtds-1.2.5.jar

# fix tomcat
sudo cp /usr/share/java/jtds-1.2.5.jar /var/lib/tomcat6/webapps/builder3/WEB-INF/lib/

# Links
http://www.java-tips.org/other-api-tips/jdbc/how-to-connect-microsoft-sql-server-using-jdbc.html

Install Eclipse

wget -q https://raw.githubusercontent.com/panticz/installit/master/install.eclipse.sh -O - | bash -

#/bin/bash

# download link
if [ "$(uname -m)" == "x86_64" ]; then
  # 64 bit
  if [ "$1" == "-e" ]; then
    URL=http://mirror.netcologne.de/eclipse/technology/epp/downloads/release/neon/R/eclipse-jee-neon-R-linux-gtk-x86_64.tar.gz
  else
    URL=http://mirror.netcologne.de/eclipse/technology/epp/downloads/release/neon/R/eclipse-java-neon-R-linux-gtk-x86_64.tar.gz
  fi
else
  # 32 bit
    if [ "$1" == "-e" ]; then
    URL=http://mirror.netcologne.de/eclipse/technology/epp/downloads/release/neon/R/eclipse-jee-neon-R-linux-gtk.tar.gz
  else
    URL=http://mirror.netcologne.de/eclipse/technology/epp/downloads/release/neon/R/eclipse-java-neon-R-linux-gtk.tar.gz
  fi
fi

# install Java JDK
wget -q https://raw.githubusercontent.com/panticz/installit/master/install.java-jdk.sh -O - | bash -

# download new eclipse release
wget -q ${URL} -P /tmp

# backup old release
[ -d /usr/lib/eclipse/ ] && sudo mv /usr/lib/eclipse/ /usr/lib/eclipse.$(date -I)

# install new release
sudo tar xzf /tmp/eclipse-*-linux-gtk*.tar.gz -C /usr/lib/

# set owner and permissions
sudo chown -R root:root /usr/lib/eclipse
sudo chmod -R +r /usr/lib/eclipse

# add executable to path
cat <<EOF> /tmp/eclipse
#!/bin/sh
export ECLIPSE_HOME="/usr/lib/eclipse"

\${ECLIPSE_HOME}/eclipse $*
EOF

sudo mv /tmp/eclipse /usr/bin/eclipse
sudo chmod 755 /usr/bin/eclipse

# fix UI bug on Debian Wheezy
. /etc/os-release
if [ "${ID}" == "debian" -a "${VERSION_ID}" == "7" ]; then
  sudo sed -i '3i export SWT_GTK3=0' /usr/bin/eclipse
fi

# create starter
cat <<EOF> /tmp/eclipse.desktop
[Desktop Entry]
Encoding=UTF-8
Name=Eclipse
Comment=Eclipse IDE
Exec=eclipse
Icon=/usr/lib/eclipse/icon.xpm
Terminal=false
Type=Application
Categories=GNOME;Application;Development;
StartupNotify=true
EOF

sudo mv /tmp/eclipse.desktop /usr/share/applications/eclipse.desktop
sudo chmod +r /usr/share/applications/eclipse.desktop

# configure memory
sudo sed -i 's|-Xmx384m|-Xmx1024m|g' /usr/lib/eclipse/eclipse.ini

# clean up
rm /tmp/eclipse-*-linux-gtk*.tar.gz

Git plugin
# http://www.vogella.com/tutorials/EclipseGit/article.html
http://download.eclipse.org/egit/updates

WindowBuilder (Java GUI creator plugin)
http://www.eclipse.org/windowbuilder/

sudo eclipse
install new software:
http://download.eclipse.org/windowbuilder/WB/release/R201209281200/4.2/

Global settings
/usr/lib/eclipse/eclipse.ini

OPTIONAL: change editor line break to 240 char
Project > Properties
Configure Worksapece Settings
Edit
Line Wraping
Maximum line widht: 240

Links
http://www.youtube.com/watch?v=WY9QbOdWkn0 - create Java Gui Tutorial (german)
http://code.google.com/intl/de/eclipse/docs/install-eclipse-3.5.html
http://sourceforge.net/projects/shelled/

Syndicate content