Meaningless Drivel is fun!*
The moose likes Java in General and the fly likes How to use JDK & JRE without setting the path in environment variable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to use JDK & JRE without setting the path in environment variable" Watch "How to use JDK & JRE without setting the path in environment variable" New topic
Author

How to use JDK & JRE without setting the path in environment variable

Rahul Shivsharan
Ranch Hand

Joined: Jun 17, 2009
Posts: 83
hi,
if i want to run java programs on my PC i have to set JAVA_HOME and PATH in environment
variables .

so once we do that , and type in CMD that "java -version", it gives me which version my JDK installed is
and if i do 'echo %PATH%' i'm able to see all the folder struture which are in the path.

Now my question is,

in my current Project we are using JDK 1.4 ,
if i do 'java -version' it shows as follows,


if i do echo %JAVA_HOME% nothing is shown,

but if i do 'echo %PATH%' it gives me following info


Hence my question is, if i install latest Netbeans 6.X or latest Eclipse and just give the JDK 6 path in the IDE's environment variables, will it effect my Systems PATH which still takes jdk 1.4.2

For my Live projects which uses Jdk 1.4.2 , we are using Oracle JDeveloper IDE

Please suggest me
Manish Singh
Ranch Hand

Joined: Jan 26, 2007
Posts: 160
You can create a project in an IDE.

For example in eclipe create a project and use the .classpath file to store your classpath
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Telling an IDE to use a specific JRE for executing won't affect anything else on your system.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14150
    
  18

Rahul Shivsharan wrote:hi,
if i want to run java programs on my PC i have to set JAVA_HOME and PATH in environment
variables .

You don't really have to do that, Java doesn't require those environment variables to be set - it's just for convenience.

You can instead just type the full path each time you want to execute a Java program. Try typing in this:

C:\oracle\BIToolsHome_1\jre\1.4.2\bin\java -version

Setting the PATH is just so that you don't have to type the whole path every time. And Java itself does not use JAVA_HOME at all.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to use JDK & JRE without setting the path in environment variable