Though the same code was getting to compiled successfully with JDK 1.6 version, after upgrading to JDK 1.8 it won't compile, saying java cannot access ....class file ...as class file not found though it exists
.
I am compiling this in IntelliJ Idea 13 IDE, tried with both Rebuild option as well as configured ANT build - result is same.
Any help is highly appreciated.
cannot access IDispatchRequest
class file for com.abc.xyz.orchestrator.dispatch.IDispatchRequest not found
1 error
Compile failed; see the compiler error output for details.
at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1079)
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:882)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.Main.runBuild(Main.java:758)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.Main.start(Main.java:179)
at org.apache.tools.ant.Main.main(Main.java:268)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.ant.execution.AntMain2.main(AntMain2.java:30)
It means that javac.exe executable file, which exists in bin directory of JDK installation folder is not added to PATH environment variable. You need to add JAVA_HOME/bin folder in your machine's PATH to solve this error. You cannot compile and run Java program until your add Java into your system's PATH variable.
class file in java is generated when you compile . java file using any Java compiler like Sun's javac which comes along with JDK installation and can be found in JAVA_HOME/bin directory.
Open a command prompt window and go to the directory where you saved the java program. Assume it's C:\. Type 'javac MyFirstJavaProgram. java' and press enter to compile your code.
This issue is resolved now :). It's basically related to class path setup and only applicable for JDK 1.8.
For ex : If class 'A' has a reference to class B and class B is implementing an interface say 'C' then javac in JDK 1.8 requires both class B as well as Interface C on the class path where as prior to 1.8 only having class B on the class path was enough.
Please refer https://bugs.openjdk.java.net/browse/JDK-8055048 for more info.
Build -> Rebuild Project worked for me
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With