I am getting a compiler error when compiling Order.java file even when it contains an import statement for the other packaged class. Im not entirely sure why this is happening but here is a directory tree with some files that I have:
com/my/domain/Order.java
Inside this file are the following package and imports:package domain; import utils.MyDate;com/my/utils/MyDate.java
Inside this file are the following package and imports:package utils;
Compiler error I get when compiling Order.java :
Order.java:2: error: package com.my.utils does not exist
import com.my.utils.MyDate;
^
Order.java:5: error: cannot find symbol
public MyDate orderDate;
^
symbol: class MyDate
location: class Order
Order.java:16: error: cannot find symbol
public Order(MyDate d, double amt, String c, String p, int q){
^
symbol: class MyDate
location: class Order
Order.java:24: error: cannot find symbol
public Order (MyDate d, double amt, String c) {
^
symbol: class MyDate
location: class Order
4 errors
I am still unsure how to solve this after trying form the comments. Here is some more detail.
Existing Statements in .bash_profile :
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
export CLASSPATH=${CLASSPATH}:/Users/3aCaGa/Desktop/Java-SE-8-Programs/SimplifiedDateClass/com/my
How I am trying to compile? I am going to the java file location in the directory and running command for example :
java Order.java
For more detail on the files that and their exact contents see: https://github.com/gosem01/Java-SE-8-Programs/tree/master/SimplifiedDateClass/com/my
classpath?com/my/utils/MyDate.javamaybeimport com.my.MyDate;export PATH=$PATH/Users/3aCaGa/Desktop/Java-SE-8-Programs/SimplifiedDateClass/comalso changing it toimport com.my.MyDate;got rid of the error but now I have the cannot find symbol error when I compile Order.java:Order.java:2: error: cannot find symbol import com.my.MyDate;$PATHand/Users/...(assuming non-Windows)myfolder