This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Command Line compiling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Command Line compiling" Watch "Command Line compiling" New topic
Author

Command Line compiling

Rusty Shackleford
Ranch Hand

Joined: Jan 03, 2006
Posts: 490
In a couple of days I have to take this silly programming test to advance to senior status in my computer science program. We have to compile on the command line and am getting weird compile errors with a practice exam written over a year ago. The strange thing is it compiles fine(minus a few genrics related warnings)with eclipse), but I cannot use that in the test.

What is happening is the compiler can not find certain classes/interfaces that are pre-written. It works with 1.4 but not 1.5, and I have to use 1.5 for the test.

Here is the Node class, and List interface. When compiled seperately, there are no errors/warnings.





Here is the code for LinkedList, an abstract class. The errors that it generates are:

LinkedList.java:17: cannot find symbol
symbol: class List
public abstract class LinkedList implements List
^
LinkedList.java:19: cannot find symbol
symbol : class Node
location: class LinkedList
protected Node head;
^
LinkedList.java:23: cannot find symbol
symbol : class Node
location: class LinkedList
head = new Node(null, null); //dummy head node
^
LinkedList.java:46: cannot find symbol
symbol : class Node
location: class LinkedList
Node cur, prev;
^
LinkedList.java:69: cannot find symbol
symbol : class Node
location: class LinkedList
Node cur = head.getNext();



I realize that some of the methods are not implemented, but that is not what the errors are about. There are no packages and all .java files are in the same folder.

I even tried to create very simple classes to see if I could get those to work, but nope.

I am sure the problem is something simple, but any help will be appreciated!
[ March 01, 2006: Message edited by: Rusty Shackleford ]

"Computer science is no more about computers than astronomy is about telescopes" - Edsger Dijkstra
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
Try this.

javac -classpath . LinkedList.java
Rusty Shackleford
Ranch Hand

Joined: Jan 03, 2006
Posts: 490
Wow, thanks. I knew it was going to be something easy.

Do you know offhand what I need to do to get rid of having to use classpath?

I never had to before I started using eclipse so maybe eclipse changes a system variable?
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

You've most likely got the CLASSPATH environment variable set, and your setting doesn't include "." (which means 'the current directory.') The default when the environment variable is unset is (effectively) just "." and nothing else.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Command Line compiling
 
Similar Threads
Recursion: returning a value/not returning a value(void)
Nullpointer.. am I losing a reference in this code?
Reversing a doubly linked list
Generic Java - Linked List
need help with compareTo()