Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / April 2005

Tip: Looking for answers? Try searching our database.

Learning Java - How should I go about it?

Thread view: 
amethyst - 28 Apr 2005 07:45 GMT
I borrowed the book "Java - How to Program, 3e, Deitel & Deitel"
from my local library. But it didn't come with a CD. This book
is a tutorial for Java 2, using Java 2 SDK v1.2.1 with either
NetBeans dev. x2 2.1 or JBuilder 3 University Ed.

I couldn't find that old IDE software so I installed JDK 1.5
with netbeans from the Sun site.

The problem is that the very first program example in the Deitel
book now fails on me.

    +    +    +    +    +    +    +
public class Welcome1
{
    public static void main(String args[])
    {
        System.out.println ("Welcome to java Mark");
    }
}
    +    +    +    +    +    +    +
The last line in the next section gives the error I got from the
command line:
    +    +    +    +    +    +    +
// Directory of D:\_java\Deitel
// Welcome.java    302 bytes
// D:\_java\Deitel>java Welcome1.java
// Exception in thread "main" java.lang.NoClassDefFoundError:
Welcome1/java

    +    +    +    +    +    +    +

I've already programmed in other languages COBOL, Pascal, VB,
Java Script and have gone through C# without actually doing
anything in it.

Should I persevere with the Deitel book?

Is this initial problem I'm having with the java command line
not too important and should I just continue with the other
examples using the IDE?

The Deitel book looks a bit tedious. Can someone recommend a
book that covers all of java without spending too much time on
the simple features such as datatypes, operators and control
structures but nevertheless gives a comprehensive coverage of
advanced features; especially the cryptic object orientation.

Or, given that it's free, should I persevere with the Deitel
book?, if so - should I uninstall SDK 1.5 and install Java 2 SDK
1.2.2 (which I have)? If so - what IDE can I use for SDK 1.2.2?

Should I give up with java altogether and spend my time on C#
until I'm used to programming in the object oriented framework?
C# will surely be easier for me as the IDE, libraries, etc. are
all there.

PS: I wanted to learn java because (a) I'm told it's the
language used for Oracle forms (which is what I actually wanted
to use) and I thought it would be a bit daft trying to use
Oracle without first knowing java. (b) everyone expects me to be
able to use java anyway and it does look pretty useful.

PS: the email is fake anti-spam. Please reply here.
Daniel Munzinger - 28 Apr 2005 08:35 GMT
amethyst schrieb:
> // Directory of D:\_java\Deitel
> // Welcome.java    302 bytes
> // D:\_java\Deitel>java Welcome1.java
> // Exception in thread "main" java.lang.NoClassDefFoundError:
> Welcome1/java

It didn't fail because of the book or because of the "wrong" software.
It failed because of the missing of basic knowledge. ;-)

You need to compile the *.java before you can use it.

javac Welcome1.java

than

java Welcome1

And it will work.

Daniel
"." - 28 Apr 2005 16:54 GMT
> I borrowed the book "Java - How to Program, 3e, Deitel & Deitel"
> from my local library. But it didn't come with a CD. This book
> is a tutorial for Java 2, using Java 2 SDK v1.2.1 with either
> NetBeans dev. x2 2.1 or JBuilder 3 University Ed.

Deitel & Deitel is not a bad book. A little dated. A lot has changed since
this book was published. You might want to get a book that covers at least
1.3.1. If you are looking to work for someone else you will find that some
people are still using 1.3.1 to 1.4.2.

There is a free tutorial at http://java.sun.com. You can also download all
the J2SE JDKs from here as well.

> I couldn't find that old IDE software so I installed JDK 1.5
> with netbeans from the Sun site.

I would have gone with NetBeans 4.1 and JDK 1.4.2 but that is just me. A
lot of the 'new' features of 1.5 might cause you to create code that will
not run on 1.4 or 1.3. You can always get a 1.4.2 program to work on a 1.5
JVM.

> The problem is that the very first program example in the Deitel
> book now fails on me.
[quoted text clipped - 16 lines]
> // Exception in thread "main" java.lang.NoClassDefFoundError:
> Welcome1/java

You have to compile the Java code into p-code then run the p-code. This
means you need to do:

    javac Welcome1.java
    java Welcome1

The first command will turn Welcome1.java into Welcome1.class. The second
command will find and run the Welcome1.class code.

>     +    +    +    +    +    +    +
>
[quoted text clipped - 3 lines]
>
> Should I persevere with the Deitel book?

It would not hurt. A lot of the features in 1.2 are still in 1.5 but I'm
not sure how heavily the book will go through Swing. JDK 1.1 used AWT to
program GUI. Today people tend to use Swing to program GUI.

> Is this initial problem I'm having with the java command line
> not too important and should I just continue with the other
> examples using the IDE?

If something in the book does not work as expected you should find out why
before moving on. It could be you misread something, the book has a
typographical error, the book is just wrong, your environment is not set
up correctly, etc. Without knowing why you had the failure you will not
know if you are doing the right thing.

> The Deitel book looks a bit tedious. Can someone recommend a
> book that covers all of java without spending too much time on
> the simple features such as datatypes, operators and control
> structures but nevertheless gives a comprehensive coverage of
> advanced features; especially the cryptic object orientation.

Most people like books published by O'Reilly & Associates. I liked
Learning Java, 2nd Edition.

> Or, given that it's free, should I persevere with the Deitel
> book?, if so - should I uninstall SDK 1.5 and install Java 2 SDK
> 1.2.2 (which I have)? If so - what IDE can I use for SDK 1.2.2?

I would not go back as far as 1.2.2. Most companies are using 1.3.1 or
higher now.

> Should I give up with java altogether and spend my time on C#
> until I'm used to programming in the object oriented framework?
> C# will surely be easier for me as the IDE, libraries, etc. are
> all there.

If you ask a bunch of Java programmers this question you should expect an
obvious answer. Stick with Java. The big reason for programming in Java
are completely lost if you go to C#. That being, the Java program I write
will run on AIX, HP-UX, Solaris, Windows, Linux, etc. A C# program will
run on Windows.

> PS: I wanted to learn java because (a) I'm told it's the
> language used for Oracle forms (which is what I actually wanted
> to use) and I thought it would be a bit daft trying to use
> Oracle without first knowing java. (b) everyone expects me to be
> able to use java anyway and it does look pretty useful.

I don't know anything about Oracle forms. Maybe you should ask an Oracle
newsgroup if you really need to learn Java.

Signature

Send e-mail to: darrell dot grainger at utoronto dot ca

Aki \ - 28 Apr 2005 17:12 GMT
. wrote:

> There is a free tutorial at http://java.sun.com. You can also download all
> the J2SE JDKs from here as well.

The Sun site has indeed proven its worth as an information source
countless times.

Signature

-Aki "Sus" Laukkanen
"Älä multa kysy tai mä vastaan!"
"Don't ask me or I'll answer!"



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.