By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,159 Members | 1,880 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,159 IT Pros & Developers. It's quick & easy.

Setting Classpath

Ganon11
Expert 2.5K+
P: 3,652
Hey all,

I'm setting up my computer to run Java for a class I'm taking, and I've gotten into a bit of a snag.

I've set the CLASSPATH system variable to include the base folder of my homeworks etc:

"CLASSPATH=C:\Users\Ganon11\Documents\Programm ing in Java;..."

I can now use the java and javac commands when my files are located in this folder. However, for organization, I wanted to put my files in separate folders based on the assignment; the first homework files go into folder HW 1, etc. etc. I expected that the javac command would still work in a subfolder of Programming in Java, but it's not working properly.

I know I can set the CLASSPATH to include the HW 1 folder, but considering there will be close to 15 homeworks, I'm not too enamored with the solution. Is there a way to apply the CLASSPATH to all subfolders of Programming in Java?

I tried putting "CLASSPATH=C:\Users\Ganon11\Documents\Programm ing in Java\*;..." but it didn't work.

Thanks in advance.
Sep 6 '08 #1
Share this Question
Share on Google+
1 Reply


Expert 10K+
P: 11,448
If you use those subfolders hw1, hw2, ... etc. as packages it'll work again, e.g.

Expand|Select|Wrap|Line Numbers
  1. package hw1;
  2.  
  3. public class Test { ... }
  4.  
store this file in the hw1 folder and compile it like this: "javac hw1.Test.java" and
run it like this: "java hw.Test". Make sure that the compiled .class files are at
their correct locations as well.

kind regards,

Jos
Sep 7 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.