Java eclipse运行我的代码的旧版本

时间:2016-03-03 20:26:28

标签: java eclipse

突然出现了一个奇怪的问题。我无法执行当前的代码。 Eclipse执行旧版本的代码。

我已经阅读了一些关于此的解决方案,但它们都没有在我的项目上工作。

我做了[ "${#p[@]}" -gt 1 ] && echo "${p[-2]}" Project > Clean ,将我的项目内容更改为Project > Build Automatically,Eclipse仍然执行旧版本的代码。

这是需要执行的代码。

System.out.println("hello");

这是我的代码的旧版本:

public static void main(String[] args) throws IOException {
      Configuration config = HBaseConfiguration.create();

        HTable hTable = new HTable(config, "users");

        Put p = new Put(Bytes.toBytes("2")); 

        p.add(Bytes.toBytes("username"),
        Bytes.toBytes("usr"),Bytes.toBytes("dino"));

        p.add(Bytes.toBytes("password"),
        Bytes.toBytes("pass"),Bytes.toBytes("123"));

        hTable.put(p);
        System.out.println("data inserted");

        hTable.close();

    }

我发现a solution表示如果存在语法错误,eclipse会运行旧代码。我删除了所有代码,并写了public static void main(String[] args) throws IOException { Configuration config = HBaseConfiguration.create(); HTable table = new HTable(config, "myLittleHBaseTable"); Put p = new Put(Bytes.toBytes("myLittleRow")); p.add(Bytes.toBytes("myLittleFamily"), Bytes.toBytes("someQualifier"), Bytes.toBytes("Some Value")); table.put(p); Get g = new Get(Bytes.toBytes("myLittleRow")); Result r = table.get(g); byte[] value = r.getValue(Bytes.toBytes("myLittleFamily"), Bytes .toBytes("someQualifier")); } ,但它仍然执行我的代码的旧版本。

Second solution对我也没有帮助。我只有一个工作区,我目前正在使用它。

3 个答案:

答案 0 :(得分:0)

如果您在任何服务器上运行代码,则可能存在用于部署的jar或war文件。但如果它是一个简单的hello world程序,那么请尝试重新导入项目然后重建它。

答案 1 :(得分:0)

由于我正在使用Play Framework,我只是去了我的项目的路径,然后写了#34;播放eclipsify"并且当前代码有效。

答案 2 :(得分:0)

由于您正在使用Play Framework(如您自己的回答中所述),您应该尝试:

  1. activator clean,然后

  2. activator compile重建。

  3. 如果您没有使用TypeSafe Activator,请将activator替换为play

    这可能是一种比重新破坏项目更直接的方法。

相关问题