In a folder I have `{HelloWorld,FakeContext}.java` and face:
```bash javac -source 1.10 -target 1.10 -cp /opt/android-sdk/platforms/android-36/android.jar HelloWorld.java ``` ``` warning: [options] system modules path not set in conjunction with -source 10 HelloWorld.java:8: error: '.' expected import FakeContext; ^ 1 error 1 warning ```
Apr 11, 9:11pm
The error you're encountering is due to how you're trying to import FakeContext in your HelloWorld.java file. Let's break down the issue and how to fix it:
indicates that the compiler expects a .java file or a package-qualified import, but you're trying to import FakeContext directly as if it were a package or a static import.
If FakeContext is a class in the same directory, you should import it with its package name (if it has one) or as a static import if it's a static class.
2. System Modules Path Warning
The warning:
text
warning: [options] system modules path not set in conjunction with -source 10
is related to the -source 10 flag and the Java module system. It's not the cause of your error, but you can suppress it by using a more modern -source and -target version (e.g., -source 11 -target 11).
How to Fix
Option 1: Import FakeContext Correctly
If FakeContext is a class in the same directory (no package), you should import it like this:
java
import FakeContext;
But if it's in a package (e.g., com.example), you should import it as:
java
import com.example.FakeContext;
Option 2: Compile Both Files Together
If both HelloWorld.java and FakeContext.java are in the same directory, you can compile them together: