I’m running IntelliJ Idea under linux. I have created a project and a module inside it, and in that module I have a class (MyClass.class) and when I’m trying to run it from IDE, I get
ERROR: MyClass.class (No Such file or directory)
Can somebody explain me why IntelliJ Idea doesn’t recognize the classes inside my module? I know it should be a problem regarding module settings but I can’t figure it out. I’m using Ubuntu 11.10
OK I place here the paths and everything for all to see 🙂
type : echo $PATH
Result:
/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/java-7-openjdk-i386/bin:/usr/lib/jvm/java-7-openjdk-i386/bin:/usr/lib/jvm/java-7-openjdk-i386/bin
type: echo $JAVA_HOME
Result:
/usr/lib/jvm/java-7-openjdk-i386
type: ./idea.sh
Result:
NOTE: If you have both Sun JDK and OpenJDK installed
please validate either IDEA_JDK or JDK_HOME environment variable points to valid Sun JDK installation
Arkde, I have a possible explanation why Jaroslav’s solution with JDK7 didn’t work for you.
Maybe you had mixed Java versions in various alternatives items, possibly conflicting with the version that environment variables like
JAVA_HOMEandJDK_HOMEpoint to?Maybe something points to the
/usr/lib/jvm/default-javasymlink as the JDK home, and that symlink points to a different version of JDK than intended?Did you try resetting alternatives for all Java tools to version 7? Like this:
What do the following commands output on your system?
I had exactly the same problem.
I’ve performed strace on the Idea process and in the log I saw it trying to open several .class files without the path to them specified – like
open("SomeClass.class", O_RDONLY) = -1 ENOENT (No such file or directory)– no path to the project output directory and to appropriate package.So I’ve apt-get installed JDK 7 along JDK 6:
In Ubuntu 11.10 Oneiric, OpenJDK 6 isn’t removable if you want OpenJDK 7. JDK 7 is dependent on JDK 6…
So I’ve:
/usr/lib/jvm/default-javasymlink to point tojava-7-openjdk-amd64,JAVA_HOMEandJDK_HOMEboth point to/usr/lib/jvm/default-java),and voila – problem solved!