小编Cac*_*eli的帖子

启动时出现Eclipse崩溃 - JVM终止.退出代码= 2

我会尽力使我的情况尽可能清楚.我试过谷歌搜索错误信息,但我没有找到任何关于exit code=2任何地方的话题.我只找到了关于不同退出代码的主题,我正在尝试按照那里给出的建议解决我的问题 - 到目前为止没有运气.对于任何形式的Linux(我使用的发行版都是Ubuntu),我也是新手.

问题:

我的eclipse在启动时崩溃,弹出以下错误窗口:

JVM terminated. Exit code=2
/usr/bin/java
-Xms40m
-Xmx384m
-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=/usr/share/eclipse/dropins
-jar /usr/lib/eclipse//plugins/org.eclipse.equinox.launcher_1.3.0.dist.jar
-os linux
-ws gtk
-arch x86_64
-showsplash /usr/lib/eclipse//plugins/org.eclipse.platform_3.8.1.dist/splash.bmp
-launcher /usr/lib/eclipse/eclipse
-name Eclipse
--launcher.library/usr/lib/eclipse//plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.dist/eclipse_1503.so
-startup /usr/lib/eclipse//plugins/org.eclipse.equinox.launcher_1.3.0.dist.jar
--launcher.overrideVmargs
-exitdata 670018
-vm /usr/bin/java
-vmargs
-Xms40m
-Xmx384m
-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=/usr/share/eclipse/dropins
-jar /usr/lib/eclipse//plugins/org.eclipse.equinox.launcher_1.3.0.dist.jar
Run Code Online (Sandbox Code Playgroud)

有一个很大的可能性,我的问题与缺乏正确的Java版本安装有关.

我怀疑这是因为:

两天前我在电脑上运行了日食.昨天我不得不使用一个Web应用程序,它需要安装特定版本的JRE.由于我缺乏Linux知识,我花了几个小时删除我当前安装的Java JRE和JDK(所以我可以安装所需的版本)使用我在互联网上找到的多个指南(一些包括命令sudo apt-get purge java*和其他命令,包括删除,java和*).今天我的Eclipse不会推出.

我跑的时候

java -version
Run Code Online (Sandbox Code Playgroud)

它没有说这样的文件或目录,但像http://www.java.com/en/download/testjava.jsp http://javatester.org/version.html 这样的网页 可以正常工作并说我的java版本是

Vendor: Oracle Corporation 
Version: Java SE 7 Update 25 
Operating System: Linux 3.5.0-34-generic 
Java Architecture: 64-bit
Run Code Online (Sandbox Code Playgroud)

使用此方法安装:

sudo add-apt-repository …
Run Code Online (Sandbox Code Playgroud)

eclipse crash jvm launch

6
推荐指数
1
解决办法
2万
查看次数

无法在 Chrome 中使用 Selenium 的新打开的选项卡中转到“chrome://downloads/”

我正在使用 Selenium 和 Java 为 Chrome 浏览器编写测试。我的问题是在我测试的某个地方,我下载了一些东西,它涵盖了一个网络元素。我需要关闭该下载栏(我无法滚动到该元素)。我搜索了很多并缩小到这种方式以在新选项卡中打开下载页面:

((JavascriptExecutor) driver).executeScript("window.open('chrome://downloads/');");
Run Code Online (Sandbox Code Playgroud)

它会打开那个新选项卡,但不会转到下载页面。

我还添加了这个:

driver.switchTo().window(tabs2.get(1));
driver.get("chrome://downloads/");
Run Code Online (Sandbox Code Playgroud)

但它也不起作用。

我试过:

driver.findElement(By.cssSelector("Body")).sendKeys(Keys.CONTROL + "t");
Run Code Online (Sandbox Code Playgroud)

action.sendKeys(Keys.CONTROL+ "j").build().perform();
action.keyUp(Keys.CONTROL).build().perform();
Thread.sleep(500);
Run Code Online (Sandbox Code Playgroud)

但谁也没有打开标签。

java selenium selenium-chromedriver selenium-webdriver

6
推荐指数
1
解决办法
3127
查看次数

如何防止游戏控制器按钮 B 退出应用程序/导航回 tvOS 中的菜单

B默认情况下,游戏控制器按钮会退出应用程序并导航回 tvOS 主屏幕。起初我认为这很直观,但很快意识到这就是 Nimbus MENU 按钮(控制器的中间部分)的用途,而且我实际上想B在游戏中使用按钮。

为按钮设置更改处理程序B有效,但释放按钮时应用程序仍会退出。

GCControllerButtonValueChangedHandler buttonBHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed) {
        NSLog(@"B");
};
Run Code Online (Sandbox Code Playgroud)

gamecontroller tvos

5
推荐指数
1
解决办法
1331
查看次数

最终方法在java中的确切方式

class Clidder {
    private final void flipper() {
        System.out.println("Clidder");
    }
}
public class Clidlet extends Clidder {
    public final void flipper() {
        System.out.println("Clidlet");
    }
    public static void main(String args[]) {
        new Clidlet().flipper();
    }
}
Run Code Online (Sandbox Code Playgroud)

结果是什么?对于这个问题,我期待答案"编译失败",因为最终方法不能被覆盖,并且它不允许继承.但答案是"Cliddet"为什么会这样?我是否误解了这个概念中的某些内容.这怎么可能是输出?请解释.

java final

5
推荐指数
1
解决办法
114
查看次数

AQL 构建域对象不返回结果

我遇到了一个问题,即在使用 AQL 时,我无法获得我在构建域对象上进行的任何查询以返回

当我做以下卷曲时:

curl -X GET -H "X-JFrog-Art-Api: myArtifactroyKey" -H "Cache-Control: no-cache" "https://MyArtifactoryServer/artifactory/api/build/"
Run Code Online (Sandbox Code Playgroud)

我得到一组结果:

{
  "builds": [
    {
      "uri": "/someBuild",
      "lastStarted": "2017-02-15T22:02:49.066+0000"
    },
    {
      "uri": "/someOtherBuild",
      "lastStarted": "2017-02-15T21:45:09.590+0000"
    }, 
      "uri": "/someThirdBuild",
      "lastStarted": "2017-02-15T21:17:38.794+0000"
    }
],
  "uri": "https://myArtifactoryServer/artifactory/api/build"
}
Run Code Online (Sandbox Code Playgroud)

所以我知道我的 Artifactory 中有构建

但是,当我进行以下 curl 时,我相信这是请求任何名称的所有构建,我没有得到任何结果

curl -X POST -H "X-JFrog-Art-Api: myArtifactroyKey" -H "Content-Type: application/x-www-form-urlencoded" -H "Cache-Control: no-cache" -d 'builds.find({"name": {"$match":"*"}})' "https://MyArtifactoryServer/artifactory/api/search/aql"
Run Code Online (Sandbox Code Playgroud)

返回:

{
  "results": [],
  "range": {
    "start_pos": 0,
    "end_pos": 0,
    "total": 0
  }
}
Run Code Online (Sandbox Code Playgroud)

我在使用时已经能够得到结果,items.find()但没有任何运气builds.find() 有什么我遗漏的吗? …

artifactory artifactory-query-lang

5
推荐指数
1
解决办法
328
查看次数

在Gson中,如何将JsonArray添加到JsonObject?

假设我正在尝试获得这样的Json结构:

{
  "rows": [
    {
      "date_str": "2016-07-01",
      "sleep_7_or_more_hours": true,
      "activity_minutes": "0",
      "water_5_or_more_cups": true,
      "fruit_veg_4_or_more_servings": true,
      "physical_activity_description": "walking"
    }
    {
      "date_str": "2016-07-02",
      "sleep_7_or_more_hours": true,
      "activity_minutes": "30",
      "water_5_or_more_cups": true,
      "fruit_veg_4_or_more_servings": true,
      "physical_activity_description": "walking"
    }  
    ...etc  
  ]
}
Run Code Online (Sandbox Code Playgroud)

关于构建这个Json的一些问题:

  1. 我该如何指定名称JsonArray?我需要它在Json中命名"rows".
  2. 如何添加JsonArray rows到a JsonObject(我假设外括号的意思是什么)?

这是我用来做的代码:

JsonArray rows = new JsonArray();

//Code to get local dates omitted
for (LocalDate date = start; !date.isAfter(end); date = date.plusDays(1))
{
    JsonObject row = new JsonObject();

    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-mm-dd", Locale.ENGLISH);
    String …
Run Code Online (Sandbox Code Playgroud)

java json gson

4
推荐指数
1
解决办法
1万
查看次数

Angular $ http.get没有传递参数

这似乎是一个简单的问题,我必须忽略一些小事.

我有一个访问Spotify API并搜索艺术家的功能.我知道通过普通URL访问此路由会返回结果.(例如http://localhost:3001/search?artist=%27Linkin%20Park%27)这里的代码:

router.get('/search', function(req, res, next)
{
    var artist = req.param('artist');
    console.log("Artist: " + artist);
    smartSpot.getArtistID(artist, function(data)
    {
        console.log("Data: " + data);
        res.json(data.id);
    });
});
Run Code Online (Sandbox Code Playgroud)

然后,前端有代码搜索艺术家.这都是通过角度完成的.

angular.module('smart-spot', [])
    .controller('MainCtrl', [
        '$scope', '$http',
        function($scope, $http)
        {
            $scope.createPlaylist = function()
            {
                var artist = $scope.artist;
                console.log(artist);
                window.open("/login", "Playlist Creation", 'WIDTH=400, HEIGHT=500');
                return $http.get('/search?=' + $scope.artist) //this doesn't pass in the artist
                    .success(function(data)
                    {
                        console.log(data);
                    });

            }
        }
    ]);
Run Code Online (Sandbox Code Playgroud)

$http.get()不会在$ scope.artist`值传递正确.

javascript spotify node.js express angularjs

2
推荐指数
1
解决办法
1236
查看次数

对结构体数组的引用

我正在学习 C++ 中的引用。是否无法创建对结构数组的引用?

struct student {
    char name[20];
    char address[50];
    char id_no[10];
};

int main() {
    student test;
    student addressbook[100];
    student &test = addressbook; //This does not work
}
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

类型“student &”(非 const 限定)的引用无法使用类型“student [100]”的值进行初始化错误
C2440“初始化”:无法从“student [100]”转换为“student &”

c++ arrays struct visual-c++

2
推荐指数
2
解决办法
284
查看次数

如何使用Files.walk读取子目录中的所有文件一次?

我试图读取目录的所有子目录中的所有文件.我写了逻辑,但我做了一些稍微错误的事情,因为它在每个文件中读取两次.

为了测试我的实现,我创建了一个包含三个子目录的目录,每个子目录中包含10个文档.这应该是30份文件.

这是我正确阅读文档的测试代码:

String basePath = "src/test/resources/20NG";
Driver driver = new Driver();
List<Document> documents = driver.readInCorpus(basePath);
assertEquals(3 * 10, documents.size());
Run Code Online (Sandbox Code Playgroud)

哪里Driver#readInCorpus有以下代码:

public List<Document> readInCorpus(String directory)
{
    try (Stream<Path> paths = Files.walk(Paths.get(directory)))
    {
        return paths
                .filter(Files::isDirectory)
                .map(this::readAllDocumentsInDirectory)
                .flatMap(Collection::stream)
                .collect(Collectors.toList());
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
    return Collections.emptyList();
}

private List<Document> readAllDocumentsInDirectory(Path path)
{
    try (Stream<Path> paths = Files.walk(path))
    {
        return paths
                .filter(Files::isRegularFile)
                .map(this::readInDocumentFromFile)
                .collect(Collectors.toList());
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
    return Collections.emptyList();
}

private Document readInDocumentFromFile(Path path) …
Run Code Online (Sandbox Code Playgroud)

java file-io java-8 java-stream

2
推荐指数
1
解决办法
1097
查看次数

检查字符串是否至少包含两个字母字符

我需要检查一个字符串是否至少有两个字母字符,a1763r或者ab1244
我想我会使用类似的东西:

myString = "a123B";  
myString.Any(char.IsDigit).Count();
Run Code Online (Sandbox Code Playgroud)

但我使用的是 .net 2.0,所以这个方法Any()不存在。

有什么等价的吗?

c# c#-2.0

1
推荐指数
1
解决办法
1094
查看次数