1

Until now I always used an IDE to write my java apps. Now for different reasons, mainly also to understand more about the language and the things the IDE is just making for you, I switched to vim and have now the following problem:

I wrote two classes:

package seedInformatik.LinearList;

import seedInformatik.LinearList.*;

// A linear list. Contains LinearListElement<T>
public class LinearList<T> { 

and

package seedInformatik.LinearList; 

public class ListElement<T> {

Now I want to compile LinearList and get the following:

➜  LinearList javac LinearList.java
LinearList.java:10: error: cannot find symbol
    private ListElement<T> first; // head of list
            ^

Both classes are in the same dir. What do I miss?

Many Thanks Robin

3
  • what is the exact javac command you are using? Commented Aug 22, 2017 at 17:17
  • I'd suggest looking into a build tool like Gradle, but otherwise, you can compile all Java files in one directory with javac *.java. Commented Aug 22, 2017 at 17:17
  • thanks for the comments the javac *.java does the job as marked below Commented Aug 23, 2017 at 2:33

1 Answer 1

2

Maybe this can help:

javac *.java // compliles all java files in the dir

java MyClass // runs the particular file

If your files are under some package you need to specify the package like this:

javac com.mypackage/.*java

java com.mypackage.MyClass

I would also recommend using a build tool like maven: http://maven.apache.org/guides/getting-started/index.html#How_do_I_make_my_first_Maven_project

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.