• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Beginner - Need some help in downloading

 
sundhar rajan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am interested in learning java,i have good pgmming experience.i dont know which version to download for learning java & for certification.sun's website is confusing with too many options.Also please suggest if any text edtitor or notepad is best for pgmming.
thanks a lot for the help
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome back to JavaRanch, sundhar!

I'd recommend downloading and installing the Java 2 SE SDK. The current version is 1.4.2_05.
http://java.sun.com/j2se/1.4.2/download.html

If you're stuck figuring out how to configure your system to get started, take a look at the instructions in the "Your First Cup of Java" trail of Sun's Java Tutorial, or just ask questions in this forum.

To get started, I'd recommend using a simple text editor, like notepad, and compiling and running your programs from the command line. Learning these basic steps doesn't take that much effort, and you'd do well to understand the mechanics of how to cimpile and run a Java program, eventually including dealing with packages and the CLASSPATH.

After learning the basics, you might decide that you'd prefer to work with a fancier text editor, such as TextPad or JCreator, that will automate some of the development tasks. I'd also suggest taking a look at jEdit and BlueJ. When you really get into things, I'd suggest trying out the bigger IDEs, such as NetBeans, Eclipse, IntelliJ, and JBuilder.

If you've further questions about editors, mosey on over to our IDEs and Other Tools forum, and ask away.

Good luck.
 
Michael Wiezik
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would strongly suggest Eclipse as an advanced editor. That's a brilliant and powerful tool, it autogenerates a lot of stuff and has a lot of plugins. I've started to learn j2ee about a year ago, and I had to learn how to implement such classes as SessionBean or Servlet. After learning ECLIPSE, instead of spending 15 minutes on writing a code I have merely to choose one option in menu.
 
Robert Somerville
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I too am in dire need of help, just to get started!!

I downloaded j2sdk1.4.2_05 and it was placed in the C drive. I created a new folder called java in the C drive.

I am attempting to run Sun's Java Tutorial/Your first Cup of Java as suggested. I got to Creating Your First Application and managed to save "HelloWorldApp.java" in the java folder on the C drive.

I managed to run the Command Prompt application and to change the current directory to C:\java>

When I try to compile using javac HelloWorldApp.java I get the error 'javac' is not recognised as an internal command etc.

I tried to continue by including the full path names as part of the command and got well and truly lost, so I tried to update the Path variable. I Edited the path variable to %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SystemRoot%\j2sdk1.4.2_05\bin

I assume that %SystemRoot% means something like C:\

Most of the above path existed before I got there. I simply added ;%SystemRoot%\j2sdk1.4.2_05\bin to the end.

I still get the error, 'javac' is not recognised etc. I guess that the Path may be too long but I don't know.

As a recent convert from Macintosh where path variables were hidden from me I need a help to get started here.
 
Julian Kennedy
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Robert,

I would guess that, if you've modified your PATH through Control Panel, your problem is probably that you need to close and reopen the command window (or open a new one) so that it picks up the new path. As far as I can see, everything else that you've done is correct.

Jules
 
Parka Teoh
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yup. Just close and reopen the command window.

(Wished I had read this eariler to save me from a couple of rebooting.)
 
Robert Somerville
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I opened Command Prompt, from the Start button and it has C:\Documents and Settings\Robert Somerville> as its starting directory.

I actually feel better now that I'm not on my own.

Rob
 
Robert Somerville
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I change the directory to C:\> then try javac\HelloWorldApp.java then the system cannot find the path specified.

If I change the directory to C:\java> then try javac\HelloWorldApp.java then 'javac' is not recognisable etc.

This is why I thought that I had to try to change the Path variable, so that javac could always be found even when I was in the directory containing HelloWorldApp.java, ie the jave folder.

Incidentally, if I close the Command Prompt window and then open a new one I am back in the C:\Documents and Settings\Robert Somerville> directory.

What am I doing wrong?
 
Marilyn de Queiroz
Sheriff
Posts: 9067
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would suggest moving C:\j2sdk1.4.2_05\bin; from the end of the path to the beginning of the path.

Then go to any directory and type "javac" (without the quotes). You should get something that looks like:


[ September 05, 2004: Message edited by: Marilyn de Queiroz ]
 
Julian Kennedy
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Robert,

Firstly, the command window will typically open at your home (user) directory. That's nothing to do with the PATH or the CLASSPATH.

Note that I think you have this next bit right already, but here's an explanation: In order for Windows to recognise the javac command you must have the bin directory of the Java installation in your PATH. In your case this is %SystemRoot%\j2sdk1.4.2_05\bin. As you say %SystemRoot% translates to C: so you can just substitute that if you prefer, i.e. C:\j2sdk1.4.2_05\bin. I'm assuming that you know how to set the System PATH through Control Panel. You can check if it is set correctly by typing echo %PATH% in the command window. Also, if you execute javac in the command window, without any arguments, it should display the usage, i.e. a list of the command line options.

Now, if you want to compile HelloWorld.java you must change directory to the directory that contains it (C:\java, I believe). You then type javac HelloWorld.java (note that there's no \ as in your post). Having the \ there will mean that the compiler is looking for HelloWorld.java in the root directory, i.e. C:\HelloWorld.java. That's not what you want and is probably the reason it's not working. This will create a file called HelloWorld.class in the same directory. To run it simply execute java HelloWorld.

Note that we have achieved all of this without setting the CLASSPATH at all. If you want to compile more than one file in the same directory you will need to add "." (the current directory) to the CLASSPATH. If you want to use classes that are not part of the Java2 Platform, you will need to add the JAR file(s) containing them to the CLASSPATH. For a single stand-alone Java file you don't need a CLASSPATH at all.

Hope that helps.

Jules
 
Robert Somerville
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your help but I an still confused.

I changed directory to C:\java and then typed javac and got an error. The Command Prompt screen shows,"C:\java>javac 'javac' is not recognized etc."

I then tried, "C:\java>javac HelloWorldApp.java" and got javac is not recognized etc.

I tried "C:\java>dir" and got info on the Volume in drive C having no label, its serial number and contents, 2 dir(s) and one file, HelloWorldApp.java

I did "dir" just to assure myself that I was in the correct place.

Any ideas?
 
Julian Kennedy
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. C:\j2sdk1.4.2_05\bin isn't in your PATH. What do you get when you execute "echo %PATH%"? If you can't see C:\j2sdk1.4.2_05\bin in there then you need to add it. You can do this quickly, simply and temporarily by executing:

To add the Java bin directory to the PATH permanently, add it to the System PATH via Control Panel.

Jules
 
Robert Somerville
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did C:\java>echo %PATH%
and got
C:\WINDOWS\j2sdk1.4.2_05\bin;C:\WINDOWS and lots more.
The line above is what I find when I look in the Control Panel. Is this what should be there?
 
Julian Kennedy
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, the problem stems from the incorrect assumption that %SystemRoot% translates to C:

Given that PATH it clearly translates to C:\WINDOWS. Your Java installation directory is not in the WINDOWS directory so you need to change your System PATH in Control Panel to include C:\j2sdk1.4.2_05\bin instead of %SystemRoot%\j2sdk1.4.2_05\bin. Get it? The moral of the story being that to assume makes an ass of u and me.

Once you've done that, open up a new command window and all should be fine.

Jules
 
Robert Somerville
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jules

Mission accomplished! I now have HelloWorldApp.class in the java folder.

On my own it had taken me two weeks to get nowhere and less then a day for you to fix it.

Thanks again,

Rob
 
Julian Kennedy
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad to hear it. I hope you understand a bit better how things hang together now. If you get stuck again you know where to come.

Jules
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic