PDA

View Full Version : First Steps in Java



Stochastics
March 13th, 2008, 02:15 AM
Hi everyone,

I want to start programming in Java with Ubuntu 7.10 but i have absolutely no idea what i need to install to be up and running. I don't even know the difference between JSE and JEE...so if anyone of you can explain me what to do, i will be very happy ! Oh, i want to use the netbeans IDE from SUN.

Thanks !

Stochastics

nick_h
March 13th, 2008, 02:22 AM
Oh, i want to use the netbeans IDE from SUN.
Start by installing the netbeans package from the repositories (multiverse) - link (http://packages.ubuntu.com/search?keywords=netbeans&searchon=names&suite=gutsy&section=all).

sudo apt-get update
sudo apt-get install netbeans5.5

LaRoza
March 13th, 2008, 02:25 AM
See the sticky. It has a link to getting set up with Java.

themusicwave
March 13th, 2008, 02:28 AM
Well for starters, there are three main Java APIs They are:

Java Standard Edition(SE) - desktop applications
Java Enterprise Edition(EE) - enterprise and web applications
Java Micro Edition(ME) - Embedded applications, like cell phones

You'll most likely want Java SE to build desktop applications.

Also there are two important parts of Java, the JDK and the JRE.

The Java Development Kit(JDK) is what developers use to build applications. It has the javac jacacompiler and other tools.

The Java Runtime Eviroment(JRE) is what you need to run Java applications.

You need to install teh most recent version, version 6 of each of them:


sudo apt-get install sun-java6-bin sun-java6-jdk sun-java6-jre sun-java6-plugin


Check the version with:


java -version


Mine Says:


jon@jon-laptop-ubuntu:~$ java -version
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Server VM (build 1.6.0_03-b05, mixed mode)
jon@jon-laptop-ubuntu:~$


You now have all the tools.

No go to http://www.netbeans.org and download netbeans 6, the one in the repos is 5.5.

After that you'll need som tutorials check out:

http://www.javaranch.com particularly the cattle drives.

You should be good to go from there.

Stochastics
March 13th, 2008, 02:29 AM
Thanks !

themusicwave
March 13th, 2008, 02:34 AM
I also forgot one thing.

The Java SE API is located here, it has a list of all the libraries that make up Java SE. There are a lot of them!

http://java.sun.com/javase/6/docs/api/

Stochastics
March 13th, 2008, 03:49 AM
I've done the steps for the installation of Java, but, when i open the command line interface and write

steeve@steeve-laptop:~$ java -version
java version "1.4.2-02"
Java(TM) 2 Runtime Environment, Standard Edition (build Blackdown-1.4.2-02)
Java HotSpot(TM) Client VM (build Blackdown-1.4.2-02, mixed mode)

not the same version as you....what's going on here ?

Stochastics

themusicwave
March 13th, 2008, 03:57 AM
Did you install the packages ending in 6?

It appears you have JDK 1.4 installed, this is 2 versions behind the current one.

Did you paste my command as it is shown. Also, you may need to enable the universe and multiverse sources.

Stochastics
March 13th, 2008, 04:07 AM
Yes, I've done that, and in the synaptic manager, when i go to the installed programs, it shows sun-java6-bin, sun-java6-jdk, sun-java6-jre and sun-java6-plugin...any idea ?

Stochastics
March 13th, 2008, 04:10 AM
Check this...

steeve@steeve-laptop:~$ sudo apt-get install sun-java6-bin sun-java6-jdk sun-java6-jre sun-java6-plugin
[sudo] password for steeve:
Reading package lists... Done
Building dependency tree
Reading state information... Done
sun-java6-bin is already the newest version.
sun-java6-jdk is already the newest version.
sun-java6-jre is already the newest version.
sun-java6-jre set to manual installed.
sun-java6-plugin is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

strange huh ?

lnostdal
March 13th, 2008, 04:14 AM
you can have multiple versions of one "software-type" installed at the same time .. try



sudo update-alternatives --config java


..then make sure you select Suns version of Java .. (/usr/lib/jvm/java-6-sun/jre/bin/java is what it looks like on my machine)

after doing that try java -version again

Stochastics
March 13th, 2008, 04:19 AM
Wow, you are my hero ! :)
Thanks, it worked ! Now, i have the latest programs ;).

Stochastics.

themusicwave
March 13th, 2008, 04:19 AM
you can have multiple versions of one "software-type" installed at the same time .. try



sudo update-alternatives --config java


..then make sure you select Suns version of Java .. (/usr/lib/jvm/java-6-sun/jre/bin/java is what it looks like on my machine)

after doing that try java -version again


Thanks, I totally forgot about that command. I'm sure this will solve your issues.

You can have multiple java versions installed, this is because some applications target a specific JRE.

jcobban
March 14th, 2008, 02:35 AM
[QUOTE=themusicwave;4504794]

You need to install teh most recent version, version 6 of each of them:


When I issue the quoted command eventually the Sun license agreement is displayed. I have to demonstrate my agreement to the license requirements. How do I do that? Nothing I typed would cause the window to close and the installation to continue.

themusicwave
March 14th, 2008, 03:28 AM
It has honestly been awhile since I installed Java. Is there a GUI or just command line?

Maybe try typing y <enter>

LaRoza
March 14th, 2008, 05:29 AM
[QUOTE=themusicwave;4504794]

You need to install teh most recent version, version 6 of each of them:


When I issue the quoted command eventually the Sun license agreement is displayed. I have to demonstrate my agreement to the license requirements. How do I do that? Nothing I typed would cause the window to close and the installation to continue.

<tab> to get to the "button"