Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Source folder is not on the Java build class path, creating Java package

I am trying to create a package merge under sort, but it it saying that:

Source folder is not on the Java build class path

enter image description here

So I right click on sort folder, and try to add it to the Java build class path. But only option there is exclude, so it means it should already be included to class path. enter image description here

So how can I create the package under sort?

EDIT:

added .classpath :

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
    <classpathentry kind="output" path="bin"/>
</classpath>
like image 835
Jaanus Avatar asked Jun 06 '12 07:06

Jaanus


2 Answers

Do it from the context menu of the "src" folder itself. The "Source folder" literally means a Source Folder as designated in the Java Build Path, not just some folder that happens to contain source. The Name field wants the actual, proper in the "this is what a .java file in it would declare", qualified package name. If you just wanted to create a new folder in there to then make some new .java files, you can just use the New Folder wizard.

EDIT: Also, keep in mind that the Package Presentation setting (set from the view's local menu--the upside down triangle) might be different between the Project and Package Explorer views. Adjust as you see fit if things look the opposite of how you'd like.

like image 83
nitind Avatar answered Oct 21 '22 16:10

nitind


just right click on the folder src -> build path -> use the source folder is just this

like image 4
Renato Vasconcellos Avatar answered Oct 21 '22 16:10

Renato Vasconcellos