源文件夹不在Java构建类路径上,创建Java包 [英] Source folder is not on the Java build class path, creating Java package

查看:5268
本文介绍了源文件夹不在Java构建类路径上,创建Java包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在sort下创建一个包合并,但它说:

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


源文件夹不在Java构建类路径

Source folder is not on the Java build class path

所以我右击排序文件夹,并尝试将其添加到Java构建类路径。但只有选项有exclude,所以它意味着它应该已经包括到类路径。

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.

那么如何在排序下创建包呢?

编辑:

classpath:

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>


推荐答案

文件夹本身。 源文件夹逐字地表示在Java构建路径中指定的源文件夹,而不是恰好包含源文件夹的某个文件夹。 Name字段想要的实际,适当的在这是一个.java文件中它将声明,合格的包名称。如果你只是想在那里创建一个新的文件夹,然后制作一些新的.java文件,你可以使用新建文件夹向导。

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.

编辑:请注意,包展示设置(从视图的本地菜单设置 - 上下颠倒的三角形)可能在Project和Package Explorer视图之间不同。如果事情与您的想法完全相反,则可按照您的需求进行调整。

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.

这篇关于源文件夹不在Java构建类路径上,创建Java包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆