• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Command Line compiling

 
Rusty Shackleford
Ranch Hand
Posts: 490
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this.

javac -classpath . LinkedList.java
 
Rusty Shackleford
Ranch Hand
Posts: 490
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic