java

Install Sun / Oracle Java JDK under Ubuntu

wget -q https://raw.github.com/panticz/installit/master/install.java-jdk.sh -O - | bash -

#!/bin/bash

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

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

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

# update repository
sudo apt-get update -qq

# WORKAROUND: disable apt proxy
sudo sed -i 's|Acquire::http::Proxy|#DISABLED#Acquire::http::Proxy|g' /etc/apt/apt.conf

# install
sudo apt-get -o Acquire::http:Proxy=DIRECT install -y oracle-java7-installer

# WORKAROUND: enable apt proxy
sudo sed -i 's|#DISABLED#Acquire::http::Proxy|Acquire::http::Proxy|g' /etc/apt/apt.conf

# set java 7 as default java version
sudo update-java-alternatives -s java-7-oracle

Uninstall OpenJDK
sudo apt-get remove -y openjdk-6-jre openjdk-6-jre-headless
sudo apt-get remove -y openjdk*

Display your current java version
java -version

Links
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

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"

wget https://raw.github.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.github.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

# extract
sudo unzip /tmp/${FILE} -d /usr/share/
sudo chmod +x /usr/share/sqldeveloper/sqldeveloper.sh
rm /tmp/sqldeveloper-*-no-jre.zip

# 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=/usr/share/sqldeveloper/sqldeveloper.sh
Icon=/usr/share/sqldeveloper/icon.png
Categories=Application;Development;
EOF

# create config dir
[ ! -d /home/${USER}/.sqldeveloper ] && mkdir /home/${USER}/.sqldeveloper
cat < /home/${USER}/.sqldeveloper/jdk
/usr/lib/jvm/java-7-oracle/
EOF

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

# cleanup
rm /tmp/${FILE}
1

# ToDo
# use a repository
# configure global

Install Java JRE

wget https://raw.github.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.github.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
wget http://netcologne.dl.sourceforge.net/project/jtds/jtds/1.2.5/jtds-1.2.5-dist.zip -P /tmp/
unzip /tmp/jtds-1.2.5-dist.zip -d /tmp/
sudo cp /tmp/jtds-1.2.5.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.github.com/panticz/installit/master/install.eclipse.sh -O - | bash -

#/bin/bash

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

# install Java JDK
wget -q https://raw.github.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-jee-*-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

# 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-jee-juno-SR2-linux-gtk*.tar.gz

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/

Install NetBeans

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

#!/bin/bash

# download link
URL=http://download.netbeans.org/netbeans/8.0/final/bundles/netbeans-8.0-javaee-linux.sh

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

# download and install netbeans from homepage
wget -q ${URL} -O /tmp/netbeans-linux.sh
sudo bash /tmp/netbeans-linux.sh --silent

# cleanup
rm /tmp/netbeans-linux.sh

OPTIONAL: install MySQL driver
apt-get install libmysql-java

OLD: fix ubuntu locale settings for german
sed -i 's|en_US.UTF-8|de_DE.UTF-8|g' /etc/scim/global

OLD: disable compiz effects (Visual Effects (System > Preferences > Appearance > Visual Effects => none)
metacity --replace &

Fix bold fonts under Linux
sudo apt-get remove -y fonts-unfonts-core

Links
http://www.techytalk.info/netbeans-cannot-find-java-please-use-jdkhome-switch/ - HowTo (re)configure JAVA JDK

Connect to MySQL DB

# ubuntu package
sudo apt-get install -y libmysql-java

path: /usr/share/java/mysql-connector-java.jar

# download
wget http://ftp.gwdg.de/pub/misc/mysql/Downloads/Connector-J/mysql-connector-java-5.1.12.tar.gz -P /tmp

# extract
tar xzf /tmp/mysql-connector-java-5.1.12.tar.gz -C /tmp/

# copy to your classpath
cp /tmp/mysql-connector-java-5.1.12/mysql-connector-java-5.1.12-bin.jar ~/NetBeansProjects/classpath/

# Netbeans
add Library / Jar File
select
~/NetBeansProjects/classpath/mysql-connector-java-5.1.12-bin.jar

# create tatabase
create database java;

HqEclipse

You can install the plugin using the Eclipse Update Manager:

Help > Install new Software
Work with: http://hge.javaforge.com/hgeclipse

[ OK ]
check HqEclipse
[ Next > ]
[ Next > ]
check "I accept the terms of the license agreement"
[ Finish ]
 
confirm Security Warnings dialog with [ OK ]
 
Restart your Eclipse
 
 
 
https://j2m.googlecode.com/hg/
https://hgeclipse-demo.googlecode.com/hg/
 
http://code.google.com/p/hgeclipse-demo/
Syndicate content