aspose file tools*
The moose likes Beginning Java and the fly likes ClassPath Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "ClassPath" Watch "ClassPath" New topic
Author

ClassPath

Abhi vijay
Ranch Hand

Joined: Sep 16, 2008
Posts: 509
CLASSPATH:
C:\Program Files\Java\jdk1.6.0_04\bin\Myproject\Source

Now, I have created a directory named Myproject inside bin. Myproject contains 2 directories Source and Classes. But the command prompt says javac not a valid command inside Source. What changes should I make in the Classpath.Please help.
Reehan Lalkhanwar
Ranch Hand

Joined: Jun 16, 2007
Posts: 106
Set PATH to C:\Program Files\Java\jdk1.6.0_04\bin.
Make sure that C:\Program Files\Java\jdk1.6.0_04\bin contains the *.exe files i.e. java, javac etc.


Thank you,
Reehan
Abhi vijay
Ranch Hand

Joined: Sep 16, 2008
Posts: 509
But javac is a valid command in bin.I am able to compile files in bin.But unable to compile files in Myproject directory which is located inside bin.
Mourouganandame Arunachalam
Ranch Hand

Joined: Oct 29, 2008
Posts: 396
Hi Abhi,

As stated above, if you want to access java or javac from other than bin folder, the "bin" folder should be added in the "path" variable. So, before using javac for the first time, use the following command in your command prompt:

C:\Program Files\Java\jdk1.6.0_04\bin\Myproject\Source>set path=%path%;C:\Program Files\Java\jdk1.6.0_04\bin;

C:\Program Files\Java\jdk1.6.0_04\bin\Myproject\Source>javac <<your java program name>>

Please note, your project folder need not to be inside java installation folder under bin. You can have your project folder somewhere in any of your valid drives (for example c:\Myproject) to make it simple to access.

Hope this helps.

Mourougan
[ December 01, 2008: Message edited by: Mourouganandame Arunachalam ]

Mourougan
Open Source leads to Open Mind
Abhi vijay
Ranch Hand

Joined: Sep 16, 2008
Posts: 509
Thanks a lot!
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39882
    
  28
Originally posted by Mourouganandame Arunachalam:
Hi Abhi,
Please note, your project folder need not to be inside java installation folder under bin. . . .


A useful piece of advice. In fact you should always create a Java folder somewhere.
 
wood burning stoves
 
subject: ClassPath