0

Edit: This is not a duplicate because the other thread contains solutions and suggestions based on correcting syntax within my code. My code compiles and runs just fine within an IDE, as I already stated in the original post. I am simply placing this statement at the top so that it will not be missed by do-gooders who get too excited about the chance to mark duplicates and forget to read content. Gosh I love stackexchange.

Good afternoon! I am trying to refresh my Java skills after a lot of years off, and I am following along with an online textbook.

The textbook suggested that readers get familiar with command line usage, which wasn't really emphasized in college. One of the tasks was to drag two java classes into any working directory, compile and run them with javac and java commands.

javac TextIO.java 

works great.

javac NewWorld.java

produces 12 identical errors:

error: cannot find symbol

symbol: variable TextIO

location: class NewWorld

TextIO is the class with some subroutines that read and write to wherever. NewWorld is the main class with some little hello world type stuff that reads input and writes to a file with the TextIO class.

Help me help myself understand the command line environment. Let me know if you need more details!

Community
  • 1
  • 1
rocksNwaves
  • 5,331
  • 4
  • 38
  • 77

2 Answers2

1

What does a "Cannot find symbol" compilation error mean?

Possible issues:

  • Incorrectly spelled
  • Forgot to import
  • Forgot to declare something
  • etc.
arkdevelopment
  • 157
  • 1
  • 11
1

The most possible case of this behavior I may think of is that you didn't set CLASSPATH Environment Variable in your operating system yet. When working with IDEs, like Eclipse, they take care of it and you don't need to worry about it. There are many tutorials online pointing how to correctly set a CLASSPATH in your operating system step by step, just google for setting CLASSPATH for JRE and you find how to set it step by step. You can set it through the proper commands in command line, here are some informations about how to set it properly: https://docs.oracle.com/javase/8/docs/technotes/tools/windows/classpath.html

Przemysław Moskal
  • 3,551
  • 2
  • 12
  • 21
  • Is this the process in which I navigate to "Environment Variables" in my control panel, find the one labeled "PATH" and append the directory of my JDK bin? Or do you refer to a different process? – rocksNwaves Dec 20 '17 at 23:09
  • 1
    No, it's - you need to look for setting CLASSPATH Environment Variable, take a look at link that I post in my edited answer, I hope it helps you a bit. – Przemysław Moskal Dec 21 '17 at 05:48