Java Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingJava Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old May 14th, 2005, 06:02 AM
maralbjo maralbjo is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 13 maralbjo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 49 m 27 sec
Reputation Power: 0
JAVA_HOME vs Classpath

I am very confused about the environment variables in Java:

Please comment the following questions:

1. Is the point with the classpath to define the folder containing the java.exe and javac.exe files in order to be able to just write "java" and "javac" (and thus not the entire filepath - C:\Java\j2sdk_nb\j2sdk1.4.2\bin\java(c) myfile) when compiling and running java programs?

2. What does the JAVA_HOME environment variable do and what is the purpose with it?

3. Do I need to add to the classpath every folder (and path) where I have created my own java classes?

Any help much appreciated!!

Reply With Quote
  #2  
Old May 14th, 2005, 12:50 PM
gertcuppens's Avatar
gertcuppens gertcuppens is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 118 gertcuppens User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 28 m 17 sec
Reputation Power: 15
I found the following in the "Apache Tomcat Bible" from
Eaves, Jones & Godfrey.

Quote:


The Java SDK and Runtime Environment is now installed, to
complete the installation so Java can be used easily set the
following environment variables :

set JAVA_HOME=c:\jdk.1.4.2
set PATH=%PATH%;%JAVA_HOME%\bin


In "Java, how to program, 6th edition" from Deitel, the authors
show how you can edit these variables using the system properties
dialog by right clicking My Computer. But the purpose is the same :
Quote:


The last step before you can use the JDK is to set the PATH environment
variable to indicate where the JDK's tools are installed.


Mind you, Deitel shows you should add the complete path
c:\Program Files\Java\jdk1.5.0\bin to the PATH variable.
So, there is no need to use the JAVA_HOME variable.
And why is that ? Well, as Deitel indicates :

Quote:

The PATH environment variable on your computer designates which directories
the computer searches when looking for applications, such as the applications
that enable you to compile and run your Java applications (called javac.exe and
java.exe).


Now, about adding to the classpath every folder in which you have created your
classes. Well, I'm only in java web applications; I've never written any java
applications using Swing or AWT. I'm using Tomcat as web server and I've
never had to add the folders containing my classes to the PATH variable.
I just let Tomcat know which web applications are available and he does the rest.
So, I guess this could be similar for java applications.

Reply With Quote
  #3  
Old May 16th, 2005, 09:58 PM
dejaone dejaone is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 34 dejaone User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 47 m 11 sec
Reputation Power: 14
Java_HOME is where you put most of your jar files, so you don't have to repeat the same basic path in class path. class path is where you put all jar files you'll use.

Reply With Quote
  #4  
Old May 17th, 2005, 03:02 AM
maralbjo maralbjo is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 13 maralbjo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 49 m 27 sec
Reputation Power: 0
Okay

Quote:
Originally Posted by dejaone
Java_HOME is where you put most of your jar files, so you don't have to repeat the same basic path in class path. class path is where you put all jar files you'll use.


Well I thought the .jar files were supposed to be put in the

C:\Java\j2sdk1.4.2\jre\lib\ext

folder? That works equally well, doesn't it?

Marius

Reply With Quote
  #5  
Old May 17th, 2005, 07:00 AM
maralbjo maralbjo is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 13 maralbjo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 49 m 27 sec
Reputation Power: 0
Problemts prevail

I thank you for your efforts, but the problem remains the same; I need to spell out the entire filepath to my java.exe and java.exec file to be able to compile and rund java programs.

This is really annoying, and happens even though I have tried all sorts of combinations for the environment variables JAVA_HOME, PATH and CLASSPATH.

It shouldn't matter that I cofigure the USER variable and not the SYSTEM variable, right??

Marius

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJava Development > JAVA_HOME vs Classpath


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap