The moose likes Beginning Java and the fly likes school computer won't compile my code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "school computer won Watch "school computer won New topic

school computer won't compile my code

Jesse Crockett
Ranch Hand

Joined: Feb 03, 2005
Posts: 129
Hello, I'm using a package statement that wont compile in the classroom. It compiles in the main student computer area but not on the actual classroom computer. It works fine at home, CLASSPATH=.;..;C...., and in the main student area. Is it a classpath problem on this particular computer? The control panel is locked, so I can't change the classpath..

Edwin Dalorzo
Ranch Hand

Joined: Dec 31, 2004
Posts: 961
Well if it indeed is classpath problem you do not need access to the control panel to solve it.

You can redeclare the classpath variable from the command line:

If you are under windows I think it must be somewhat like...

...but you better check that

Another option is to use the -classpath option of the java.exe. Somewhat like this...

...under Linux use semicolons

I hope this helps!
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24193

Also note that it is never necessary, or recommended, to import a class "A" in the same package as a class "B" -- i.e., you needn't "import package3.Inventory" in a class that declares "package package3".

Is "" in your "package3" directory?

[Jess in Action][AskingGoodQuestions]
Jesse Crockett
Ranch Hand

Joined: Feb 03, 2005
Posts: 129
Actually I have no command line experience with the java compiler. I just put both classes in the same file under "package project3" and it worked.
I agree. Here's the link:
subject: school computer won't compile my code
It's not a secret anymore!