使用IntelliJ IDEA,无法弄清楚如何编译和运行一个简单的程序

时间:2013-03-11 03:28:47

标签: intellij-idea compilation

代码:

public class var3
{
    public static void main( String[] args )
    {
        int num = 113;
        double num2 = 2.71828;
        string cs = "Computer Science";
        System.out.println(num);
        System.out.println(num2);
        System.out.println(cs);
        System.out.println("hello");
    }
}

我无法弄清楚如何运行它。当我点击运行时,我看到了:

  

“C:\ Program Files \ Java \ jdk1.7.0_17 \ bin \ java”-Didea.launcher.port = 7537“-Didea.launcher.bin.path = C:\ Program Files(x86)\ JetBrains \ IntelliJ IDEA Community Edition 12.0.4 \ bin“-Dfile.encoding = UTF-8 -classpath”C:\ Program Files \ Java \ jdk1.7.0_17 \ jre \ lib \ charsets.jar; C:\ Program Files \ Java \ jdk1.7.0_17 \ jre \ lib \ deploy.jar; C:\ Program Files \ Java \ jdk1.7.0_17 \ jre \ lib \ javaws.jar; C:\ Program Files \ Java \ jdk1.7.0_17 \ jre \ lib \ jce.jar; C:\ Program Files \ Java \ jdk1.7.0_17 \ jre \ lib \ jfr.jar; C:\ Program Files \ Java \ jdk1.7.0_17 \ jre \ lib \ jfxrt.jar; C:\ Program Files \ Java \ jdk1.7.0_17 \ jre \ lib \ jsse.jar; C:\ Program Files \ Java \ jdk1.7.0_17 \ jre \ lib \ management-agent.jar; C:\ Program Files \ Java \ jdk1 .7.0_17 \ jre \ lib \ plugin.jar; C:\ Program Files \ Java \ jdk1.7.0_17 \ jre \ lib \ resources.jar; C:\ Program Files \ Java \ jdk1.7.0_17 \ jre \ lib \ rt.jar; C:\ Program Files \ Java \ jdk1.7.0_17 \ jre \ lib \ ext \ access-bridge-64.jar; C:\ Program Files \ Java \ jdk1.7.0_17 \ jre \ lib \ ext \ dnsns.jar; C:\ Program Files \ Java \ jdk1.7.0_17 \ jre \ lib \ ext \ jaccess.jar; C:\ Program Files \ Java \ j dk1.7.0_17 \ jre \ lib \ ext \ localedata.jar; C:\ Program Files \ Java \ jdk1.7.0_17 \ jre \ lib \ ext \ sunec.jar; C:\ Program Files \ Java \ jdk1.7.0_17 \ jre \ lib \ ext \ sunjce_provider.jar; C:\ Program Files \ Java \ jdk1.7.0_17 \ jre \ lib \ ext \ sunmscapi.jar; C:\ Program Files \ Java \ jdk1.7.0_17 \ jre \ lib \ ext \ zipfs.jar; C:\ Programming \ unit1 \ out \ production \ unit1; C:\ Program Files(x86)\ JetBrains \ IntelliJ IDEA Community Edition 12.0.4 \ lib \ idea_rt.jar“com.intellij.rt .execution.application.AppMain Main

     

处理完成,退出代码为0

但是没有我的System.out.println();的。

1 个答案:

答案 0 :(得分:0)

它正在启动另一个名为Main的类,我想不打印任何内容:

com.intellij.rt.execution.application.AppMain **Main**

您也可以在绿色箭头旁边的组合框中看到它。如果您想要运行其他课程(此处为var3),请右键点击您的文件,然后选择Run 'var3.main()'

绿色箭头始终启动在组合框中选择的运行配置,而不是您当前正在编辑的文件。