Java Netbeans不给出提示
通常,我会从Netbeans得到一些黄色的提示。如图所示,该类无法编译,但Netbeans没有任何提示,通常我会在行号上看到一些黄色提示: 我将抛出选项配置为:Java Netbeans不给出提示,java,netbeans,exception-handling,ide,hint,Java,Netbeans,Exception Handling,Ide,Hint,通常,我会从Netbeans得到一些黄色的提示。如图所示,该类无法编译,但Netbeans没有任何提示,通常我会在行号上看到一些黄色提示: 我将抛出选项配置为: code as follows: package net.bounceme.dur.nntp.swing; import java.util.logging.Logger; import javax.swing.DefaultListModel; import javax.swing.JList; import javax.swi
code as follows:
package net.bounceme.dur.nntp.swing;
import java.util.logging.Logger;
import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.JScrollPane;
import net.bounceme.dur.nntp.gnu.Page;
import net.bounceme.dur.nntp.gnu.Usenet;
public class MyPanel extends JScrollPane {
private static final Logger LOG = Logger.getLogger(MyPanel.class.getName());
private JList jList;
private DefaultListModel defaultListModel;
private Usenet u = Usenet.INSTANCE;
private Page page;
public MyPanel() {
page = u.getPage(new Page().getPmd()); //uncaught exception
jList = new JList(defaultListModel); // null, need to initialize
initComponents();
}
private void initComponents() {
}
}
init:
Deleting: /home/thufir/NetBeansProjects/gnumail-providers/build/built-jar.properties
deps-jar:
Updating property file: /home/thufir/NetBeansProjects/gnumail-providers/build/built-jar.properties
Compiling 1 source file to /home/thufir/NetBeansProjects/gnumail-providers/build/classes
/home/thufir/NetBeansProjects/gnumail-providers/src/net/bounceme/dur/nntp/swing/MyPanel.java:19: error: unreported exception Exception; must be caught or declared to be thrown
page = u.getPage(new Page().getPmd()); //uncaught exception
Note: /home/thufir/NetBeansProjects/gnumail-providers/src/net/bounceme/dur/nntp/swing/MyPanel.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
/home/thufir/NetBeansProjects/gnumail-providers/nbproject/build-impl.xml:624: The following error occurred while executing this line:
/home/thufir/NetBeansProjects/gnumail-providers/nbproject/build-impl.xml:243: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 0 seconds)
我也没有看到关于声明对象的提示。就像提示被禁用一样。如何重新启用提示
编辑:
code as follows:
package net.bounceme.dur.nntp.swing;
import java.util.logging.Logger;
import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.JScrollPane;
import net.bounceme.dur.nntp.gnu.Page;
import net.bounceme.dur.nntp.gnu.Usenet;
public class MyPanel extends JScrollPane {
private static final Logger LOG = Logger.getLogger(MyPanel.class.getName());
private JList jList;
private DefaultListModel defaultListModel;
private Usenet u = Usenet.INSTANCE;
private Page page;
public MyPanel() {
page = u.getPage(new Page().getPmd()); //uncaught exception
jList = new JList(defaultListModel); // null, need to initialize
initComponents();
}
private void initComponents() {
}
}
init:
Deleting: /home/thufir/NetBeansProjects/gnumail-providers/build/built-jar.properties
deps-jar:
Updating property file: /home/thufir/NetBeansProjects/gnumail-providers/build/built-jar.properties
Compiling 1 source file to /home/thufir/NetBeansProjects/gnumail-providers/build/classes
/home/thufir/NetBeansProjects/gnumail-providers/src/net/bounceme/dur/nntp/swing/MyPanel.java:19: error: unreported exception Exception; must be caught or declared to be thrown
page = u.getPage(new Page().getPmd()); //uncaught exception
Note: /home/thufir/NetBeansProjects/gnumail-providers/src/net/bounceme/dur/nntp/swing/MyPanel.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
/home/thufir/NetBeansProjects/gnumail-providers/nbproject/build-impl.xml:624: The following error occurred while executing this line:
/home/thufir/NetBeansProjects/gnumail-providers/nbproject/build-impl.xml:243: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 0 seconds)
显示此类编译失败的堆栈跟踪:
code as follows:
package net.bounceme.dur.nntp.swing;
import java.util.logging.Logger;
import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.JScrollPane;
import net.bounceme.dur.nntp.gnu.Page;
import net.bounceme.dur.nntp.gnu.Usenet;
public class MyPanel extends JScrollPane {
private static final Logger LOG = Logger.getLogger(MyPanel.class.getName());
private JList jList;
private DefaultListModel defaultListModel;
private Usenet u = Usenet.INSTANCE;
private Page page;
public MyPanel() {
page = u.getPage(new Page().getPmd()); //uncaught exception
jList = new JList(defaultListModel); // null, need to initialize
initComponents();
}
private void initComponents() {
}
}
init:
Deleting: /home/thufir/NetBeansProjects/gnumail-providers/build/built-jar.properties
deps-jar:
Updating property file: /home/thufir/NetBeansProjects/gnumail-providers/build/built-jar.properties
Compiling 1 source file to /home/thufir/NetBeansProjects/gnumail-providers/build/classes
/home/thufir/NetBeansProjects/gnumail-providers/src/net/bounceme/dur/nntp/swing/MyPanel.java:19: error: unreported exception Exception; must be caught or declared to be thrown
page = u.getPage(new Page().getPmd()); //uncaught exception
Note: /home/thufir/NetBeansProjects/gnumail-providers/src/net/bounceme/dur/nntp/swing/MyPanel.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
/home/thufir/NetBeansProjects/gnumail-providers/nbproject/build-impl.xml:624: The following error occurred while executing this line:
/home/thufir/NetBeansProjects/gnumail-providers/nbproject/build-impl.xml:243: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 0 seconds)
这不是答案,这是附加信息。问题自行解决了。也许是因为我退出了Netbeans。也许是因为我重新启动了。也许是小精灵:
需要明确的是,保存时编译仍然处于禁用状态,它与Netbeans的版本相同。在从internet网页复制了一个示例后,我遇到了同样的问题。重新启动Netbeans后,我再次收到提示。当您将“显示为:错误”更改为“显示为:警告”时,提示是否有效?该选项已灰显,无法更改。我认为这可能是其他地方的另一个设置,或者提示不适用于Swing..?您是否也可以发布代码,以便我们检查它是否与您的设置或我们的设置有关。完整项目位于github上:它设置为作为Netbeans项目签出。但是,它有一些JAR依赖项。@您是否尝试过重新安装NetBeans?