Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > BOOK: Beginning Java 2
|
BOOK: Beginning Java 2
This is the forum to discuss the Wrox book Beginning Java 2, SDK 1.4 Edition by Ivor Horton; ISBN: 9780764543654
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Java 2 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 5th, 2004, 07:19 AM
Registered User
 
Join Date: Jul 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default SDK compiler and interpreter

 hello i got the book recently and JAVA it´s the first programming language that i am going to learni got the SDK, i know the interpreter and the compiler are in the folder Bin but what are these file´s names I need someone to answer me, if you read and you can help me, please answer, thanks.
AAAAAAAAAAAAAAH WHAT AM I SUPOSSED TO DO TO COMPILE A PROGRAMM?
 
Old July 7th, 2004, 12:53 PM
Authorized User
 
Join Date: Sep 2003
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Default


Welcome to an endless journey to Java. All aboard!

What do you mean: what are these file´s names

So (in Windows) you are working from the MS-DOS command line to compile and run your Java files. You go to the current directory (containing the files you want to compile and run), by navigating your way to it:

cd.. ~go to parent directory
cd dirName ~go to dirName directory
dir ~show all files and child directories
java ~to run java
javac ~to compile java files (create class files)

Suppose the Java class you just created is called MyWork. Then you would call java MyWork from the current directory to launch the MyWork.class file that is in it.
This always works if the path to the bin directory where java resides is known to your system. So in Windows you would set the classpath - see the SDK documentation you've got.

Beforehand you have called javac MyWork.java to compile the file, of course. javac is in the bin, same explanation: the classpath must be found automatically by the system and you set it ONCE to work forever.

AAAAAAAAAAAAAAH was also my first reaction to Java. You've got the right spirit! Hang on!

Francis @ chapter 15
 
Old July 7th, 2004, 02:04 PM
Registered User
 
Join Date: Jul 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks, but it says that the javac is not recognized as an internal or external command, y? and how do i set the classpath? java -classpath and then what?
 
Old July 8th, 2004, 04:01 AM
Authorized User
 
Join Date: Sep 2003
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by pedr0
 and how do i set the classpath? java -classpath and then what?
Yea, right, you must set the bin FIRST in the classpath. This cannot be done from the MS-DOS prompt. Browse your SDK documentation to find the appropriate way to set the classpath on your system!

(I told you so)
bye now
Francis



 
Old July 8th, 2004, 07:44 AM
Registered User
 
Join Date: Jul 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

look, i go to the classpath documentation and there are two methods to set the classpath, but both methods are with command lines, and they are to set a .class, not the bin folder. And other question, does it matter that my SDK is installed in the drive (E:)?
 
Old July 8th, 2004, 08:16 AM
Authorized User
 
Join Date: Sep 2003
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by pedr0
 look, i go to the classpath documentation and there are two methods to set the classpath, but both methods are with command lines, and they are to set a .class, not the bin folder. And other question, does it matter that my SDK is installed in the drive (E:)?
What's the problem with installing the SDK and the bin directly on the computer? That is what most people do, and it's very convenient. If you want it in the drive setting the classpath permanently might be impossible, I don't know...

Install the bin in some directory on your C harddisk. What operating system or Windows version are you using? Go to the page of the SDK documentation that deals with setting the classpath for that version, and follow the instructions carefully (CAREFULLY!) step by step. I use windows ME, if you do I can help you, my girlfriend's OS is XP, is OK, we can figure that one out..

P.S. My mother comes to Las Galletas in the winter, where do you live in Tenerife?
 
Old July 8th, 2004, 08:52 AM
Registered User
 
Join Date: Jul 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ooh ok, i will put it in C:. i have xp. Man do you have msn, so it´s easier for me and i get the reply much faster, do u mind?
 
Old July 8th, 2004, 11:19 AM
Authorized User
 
Join Date: Sep 2003
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by pedr0
 ooh ok, i will put it in C:. i have xp. Man do you have msn, so it´s easier for me and i get the reply much faster, do u mind?
Can you explain MSN for me? I am at my girlfriend's XP.

Anyway, you SHOULD be able to follow the instructions in the SDK for the classpath settings (& put your new bin 1st!)
Please take this step by step, it is not easy, but you can enjoy its results in your coming year of hard study on Ivor Horton's book!

:0)
Francis @ ch15

 
Old July 8th, 2004, 08:28 PM
Authorized User
 
Join Date: Jul 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to yuji_chen
Default

Hi, welcome to the java world :D
Let me give u some idea on the basic of java, with u should get it from ur book which i believe.

Java file is a pure text file contain java code, u can use any text editor to edit it. After u have finish ur code save it under .java file. Use the compiler to compile it to .class file and u r done.

So how we compile the .java file, set ur path to point to the jdk/bin folder in ur system env. Path is different with classpath, path is tell u system where to find the bin folder, it same like a alias, but classpath is tell ur compiler where it should look for the .java and .class file. After that set ur classpath to look for the local folder by setting CLASSPATH = .;%CLASSPATH% the dot operator will telll the compiler to look for ur java file where u run the command.

if u want to check whether u set the path correctly or not, open ur cmd n type java -version then u should see something, n compile ur file by typing javac follow by ur .java file. before that u must inside the folder where ur .java file reside.
Hope this will help u ;)

have a nice learning in java






Similar Threads
Thread Thread Starter Forum Replies Last Post
Compiler Romaunt V. Intro Programming 2 October 18th, 2008 06:27 AM
Using SDK Eliasson Java Basics 5 December 29th, 2005 04:53 AM
For all who need a C/C++ compiler... Ammiel C++ Programming 1 July 17th, 2003 01:42 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.