NetbeansInstallation (1708.0K)

braintreesmileSoftware and s/w Development

Aug 15, 2012 (4 years and 11 months ago)

261 views

N
ET
B
EANS

I
NSTALLATION

ON
L
INUX

One effect of most
of the JDK code
being
now available under GPLv2

is that

the
demand for integrated developmental environment

to create Java solutions
is
getting

a great
er attention and

push
.

NetBeans and Eclipse are two exc
ellent
open
source
IDEs

with liberal licensing terms
.
(Keep in mind that being open source and
having liberal licens
e

are two
different

things. Being open
source

does not
guarantee

liberal license
.
)

NetBeans is available under
mixed

licensing terms. Its li
censes are a mix of GPLv2
with some exception and

Common Development and Distribution License (CDDL)
.
CDDL

is one of the licenses that have gone through approval process of Open Source
Initiative

(
http://www.opensource.org/licenses/category
) and comply wit
h
its

Open
Source Definition.

An
executive

summary about CDDL is available at
http://www.sun.com/cddl/CDDL_why_details.html
. CDDL allows developers to
view, use, edit, and alter the code, and distribute it or use it in production.

It is
because NetBeans is

not completely under GPL, it is not carried in Red Hat/Fedora
distributions.

Net
B
eans installation on Red Hat based Linux distributions is
very easy
. Download
latest version of netbeans from
http://www.netbeans.org/downloads/
.
NetBeans

Integrated Developm
ent Environment
is available
in various bundles.

If in doubt,
download the
All

packs bundle with size around 200MB.

Switch user (su) to root.

Change directory
(cd)
to where netbeans is downloaded.
Make the downloaded
netbeans
-
verNo
-
linux.sh

file executable

(chmod +x *.sh), and
run the file as:

# chmod +x netbeans
-
6.5beta
-
linux.sh

# ./netbeans
-
6.5beta
-
linux.sh


F
IG
.

1
:

N
ET
B
EANS
P
ACKS
.

T
OMCAT SERVER IS AVAI
LABLE IF YOU
C
USTOMIZE

The first screen gives you an option to customize what al
l to install. If you are lazy or
do not care, just click
Next
. It is also a safe option.

GlassFish is the default
application server but if you want to work on Tomcat server, you have to
C
ustomize

and select it.
The next window displays License agreement.
Just accept it and click
Next
. You are now shown the location where netbeans

IDE will be installed

(
by
default,
/usr/local/netbeans
-
verNo)
. If you like, change it to another folder

(say,
/opt/netbeans
-
verNo)
. Also the installer finds out the location of in
stalled JDK and
displays it

(/usr/lib/jvm/java)
. You can point
to another JDK installation, if there is
one.

The next window is
regarding

Glass
F
ish Java Application
Server installation

(v2ur2)
.
S
everal defaults
are presented
as:

Glassfish installation fold
er:
/usr/local/glassfish
-
verNo

JDK for Glassfish application server:
/usr/lib/jvm/java

Admin user name:

admin

Admin Password:
adminadmin

HTTP port:
8080

HTTPS port:
8181

Admin port:
4848

These defaults can be changed. But do not change port numbers unless
the installer
advises you to do so

or you have reasons to change them
.

I
f
,

for example
,

another
application is
already
listening at one of the specified ports

then the port number
has to be changed
.


The next window
(in NetBeans 6.5 Beta)
pertains to

speci
fying
installation folder
for
G
lassfish

v3
-
prelude
-
b15b. Accept or change the installation folder and click
Next
.

A
summary of installation folders is presented and on clicking
Install

button,
instal
lation begins. The last window i
s regarding
(
optional
)

re
gistration.

A
DDING
G
LASS
F
ISH
SERVER

Login as any user
on your Linux machine
and start
NetBeans

as:
Applications
-
>
Programming
-
>NetBeans IDE
.
Click
Services

in the top
-
left window and expand
Servers

node

(
Fig.
2
)
. Normally GlassFish

server should be available.

GlassFish is an
open source
Java Application Server
.

It
is available under
Common Development
and Distribution License (CDDL)
.

If you have installed GlassFish separately or it does not appear under
S
erver
s

node,
proceed as bel
ow to add it.


F
IG
.

2
:

S
ERVICES WINDOW ON TO
P
-
LEFT
.

G
LASS
F
ISH SERVER DOES NOT
APPEAR

UNDER
S
ERVERS
NODE

R
ight
-
click on the
Servers

node

and click
Add

Server

(
Fig.
3
)
.



F
IG
.

3
:

R
IGHT

CLICK ON
S
ERVERS

NODE

AND IN THE CONTEXT M
ENU CLICK
A
DD
S
ERVER

Choose

Server

window appears (
Fig.
4
). Select GlassFish V2 and click
Next
.


F
IG
.

4
:

S
ELECT
G
LASS
F
ISH
V2

AND CLICK
N
EXT

Specify the folder loca
tion where GlassFish is installed (
Fig.
5
) and click
Next
. Let the
default selection of
Create Personal Domain

stay.


F
IG
.

5
:

G
LASS
F
ISH INSTALLATION FOL
DER IS TO BE SPECIFI
ED HERE
.

L
ET DEFAULT CHOICE OF

C
RE
ATE
P
ERSONAL
D
OMAIN STAY
.

C
LICK
N
EXT

In the
Domain

Folder

Location

(
Fig.
6
)
window, specify a folder where domain will be
created. On this folder the logged in user should have read/write permissions.


F
IG
.

6
:

S
PECIFY A FOLDER WHER
E THE LOGGED IN USER

HAS READ
/
WRITE PERMISSIONS

GlassFish works through domains. A domain is an application server environment
for an instance of server. By this is meant that there is one set of configuration
parameters associated

with a domain

(
Fig.
8
)
. Another domain can have another set
of configuration parameters. An application lives in this environment. There can be
multiple server environments (domains) with multiple applications running in these
an
d thus achieving independence.


F
IG
.

7
:

D
OMAIN ADMIN LOGIN PA
RTICULARS

Each domain has it’s own web
-
based administration console. Through this
console

one
can control the domain and deploy applications.

For this purpose, you need t
o
remember the
Admin Username

and
Admin Password

supplied in
Fig.
7
.


F
IG
.

8
:

S
ERVER PORTS CONFIGUR
ATION DETAILS

FOR THIS DOMAIN
.

N
OTE THAT
A
DMIN PORT IS
4894

AND NOT
DEFAULT
4848.

Note the admin port
(4894
)
for the domain being created

(
Fig.
8
)
. After the domain
has been created and server started

(
Fig.
9
)
, you can access the domain admin
-
console through
http://localhost:4894

(
Fig.
11
)
.


F
IG
.

9
:

G
LASS
F
ISH
SERVER ADDED

Anytime after GlassFish has been started, you will find it
instructive

to view server
logs to debug problems in your application. For the purpose, right
-
click on the
GlassFish under
Servers

no
de and from the context menu click
View Server Log

(
Fig.
10
)
. Very useful information regarding failure of your application can be gleaned
from these logs.


F
IG
.

10
:

G
LASS
F
ISH
SERVER
STARTED
.

S
ERVER LOGS CA
N GIVE VERY USEFUL A
PPLICATION
DEBUGGING INFORMATIO
N


F
IG
.

11
:

A
DMIN CONSOLE FOR
G
LASS
F
ISH

DOMAIN

C
ONNECTING
M
Y
SQL

SERVER

NetBeans
has variety of packs. One package of NetBeans
also
contain
s

MySQL
server.
However, as e
very RedHat ba
sed Linux distribution carries MySQL server

there is no point installing the package of NetBeans with MySQL server
. NetBeans
(or rather your Java application) will need to access the MySQL server through JDBC

driver.
NetBeans includes the MySQL java connec
tor.

Incidentally, rpm for mysql
-
connector
-
java is also available in Fedora repositories.

Its jar files get installed under
/usr/share/java.


F
IG
.

12
:

C
ONNECTING TO
M
Y
SQL

SERVER

To connect to MySQL server, in the
Services

window, ri
ght click on the
MySQL
(Connector) driver

(
Fig.
12
)
and in the context menu click on
Connect Using
.


F
IG
.

13
:

N
EW
D
ATABASE
C
ONNECTION WINDOW

A
New Database Connection

window opens

(
Fig.
13
)
.
In this window the following
information is to be supplied:

MySQL server Host IP address

(say, 192.168.1.3)

Port at which this server is listening. Generally 3306

Database name to connect to

(say, expt)

MySQL
Server
user who has necessary privi
leges over the
database

(say mahadev)

Password of MySQL user

(say, mahadev)

This information is written in a URL format as

below
(
Fig.
14
). Click OK.

jdbc:mysql://192.168.1.3:3306/expt


F
IG
.

14
:

M
Y
SQL

SERVE
R CONNECTION INFORMA
TION

A
Connection established

message will appear under
Advanced

tab

(
Fig.
15
)
.

Click
OK

to close the connection window.


F
IG
.

15
:

C
ONNECTION ESTABLISHE
D INFORMATION

The
particular
MySQL

connection will now get listed

(
Fig.
16
)
.
You can now develop
an

application that access
es

this database.

N
ext time you start NetBeans, this connection icon
(or connection badge)
will be
there.
but a wavy white line will pass thr
ough

vertically
. Right click on this
connection
-
icon and
from the context menu
click
Connect
. You will be asked to
supply jus
t

the user password and connection will be established.

Of course, you
can elect to store this password permanently in NetBeans

(se
e checkbox
Remember

Password

in
Fig.
14
)
.


F
IG
.

16
:

S
ERVICES WINDOW WITH
THE MYSQL CONNECTION

LISTED
.

N
OTE THAT OTHER ICONS

HAVE
A WAVY WHITE LINES P
ASSING THROUGH

K
ONQUEROR AS

DEFAULT

BROWSER

To change you
r preferred browser
from Firefox to Konqueror in
NetBeans, click on
Tools
-
>Options

(
Fig.
17
).


F
IG
.

17
:

A
DDING DEFAULT BROWSE
R

Under
General

options group

(
Fig.
18
)
, click on the
E
dit

button

to open Web
Browsers window (
Fig.
19
). Here fill in the form as shown in the figure and click OK.


F
IG
.

18
:

C
LICK ON
E
DIT


F
IG
.

19
:

E
DIT WINDOW
.

F
ILL IN
N
AME
,

P
ROCESS
FILE

AND ITS ARGUMENTS

From now on, Konqueror will be the default browser.

A
DDING
J
AVA
D
OCUMENTATION

To add latest Java documentation to NetBeans, download
Java SE6 Documentation

(
jdk
-
6
-
doc.zip
) from
http://j
ava.sun.com/javase/downloads
.
Now start NetBeans
and click on
Tools
-
>Java Platforms

(
Fig.
17
).

In the
Java Platform Manager
, c
lick on the
Javadoc

tab and click on the button
Add

Z
ip/Folder

(
Fig.
20
)
. In
the
Browse

window point to the just downloaded zip file.
Click
Close
.


F
IG
.

20
:

A
DD THE ZIPPED FILE Y
OU DOWNLOADED

R
ESETTING
W
INDOWS

As NetBeans has number of windows, it is not unusual to close a window by mistake
or to disturb a w
indow’s location. To bring the windows back to their default
settings
,

click,
Window
-
>Reset Windows

(
Fig.
21
).


F
IG
.

21
:

R
ESETTING WINDOWS


*********************