Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > BOOK: Beginning Java 2
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 28th, 2005, 01:29 PM
Registered User
 
Join Date: Mar 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default classpath

 kindly tell everything related to classpath n other
  environment variables available for Java2 in windows 98.
  wats the role of classpath while using packages.


  #2 (permalink)  
Old March 28th, 2005, 11:35 PM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by ekta
  kindly tell everything related to classpath n other
  environment variables available for Java2 in windows 98.
Sorry, I can't answer that, although I too use win98, so I might be able to answer more specific questions. I suggest you read the book.

Quote:
quote:wats the role of classpath while using packages.
I don't know if you've ever tried to compile and execute a file that is part of a package, but Java doesn't make it very easy. Given this directory structure:

C:
--javaPrograms folder
------Pack1 folder
------------DemoA.java

The only way I have figured out to compile(javac) a source file(.java) is to change the DOS prompt to the folder containing the source file:

C:\javaPrograms\Pack1>

and then compiling:

C:\javaPrograms\Pack1> javac DemoA.java

When you are executing(java) your program, the classpath tells java where to look for the package folder. One way you can tell java where to look for the package folder is with the classpath flag. In the classpath flag, you specify the folder that contains the package folder:

C:\javaPrograms\Pack1> java -classpath C:\javaPrograms Pack1.DemoA

Or, you can permanently set the CLASSPATH environment variable, which does the same thing as the classpath flag, but it is a permanent setting. That means java will search all the directories listed under CLASSPATH for the package, and you don't need to include the classpath flag in the java command to execute your program.

You should note that if you switch the DOS prompt to the directory/folder that contains the package folder, you can execute your program without specifying a classpath flag or setting the CLASSPATH environment variable. For instance, in the above example, if you change the DOS prompt:

C:\javaPrograms\Pack1> cd ..

to get the prompt:

C:\javaPrograms>

You can execute the program from there like this:

C:\javaPrograms> java Pack1.DemoA
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
classpath? abdi Java GUI 1 December 8th, 2004 04:44 PM
chapter1 CLASSPATH jeanne JSP Basics 2 August 11th, 2004 12:45 AM
setting classpath aadz5 JSP Basics 1 July 28th, 2004 04:04 PM
how to set the classpath sxj1209 JSP Basics 3 March 29th, 2004 04:36 PM



All times are GMT -4. The time now is 04:28 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.