小编Nin*_*xor的帖子

JavaFX并使用Ant编译HelloWorld

我正在跟随oracle的教程,当我在编译代码后尝试运行jar文件输出时收到此错误消息.

Error: Could not find or load main class HelloWorld
Run Code Online (Sandbox Code Playgroud)

为了设置java开发环境,我去了oracle并下载了他们的Java SE Development Kit并将其放入/usr/lib/jvm/jdk1.8.0_45,然后在build.xml文件中指出它.

在本教程中,我有一个包含以下代码/脚本的项目文件夹:

(实施例/ SRC/HelloWorld.java)

import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

public class HelloWorld extends Application {

    @Override
    public void start(Stage primaryStage) {
        Button btn = new Button();
        btn.setText("Say 'Hello World'");
        btn.setOnAction(new EventHandler<ActionEvent>() {

            @Override
            public void handle(ActionEvent event) {
                System.out.println("Hello World!");
            }
        });

        StackPane root = new StackPane();
        root.getChildren().add(btn);

        Scene scene = new …
Run Code Online (Sandbox Code Playgroud)

ant javafx

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

如何检查字符串是否有效YAML?

我想检查字符串是否有效YAML.我想在我的Ruby代码中使用gem或库执行此操作.我只有这个开始/救援条款,但它没有得到适当的救援:

def valid_yaml_string?(config_text)
  require 'open-uri'
  file = open("https://github.com/TheNotary/the_notarys_linux_mint_postinstall_configuration")
  hard_failing_bad_yaml = file.read
  config_text = hard_failing_bad_yaml
  begin
    YAML.load config_text
    return true
  rescue
    return false
  end
end
Run Code Online (Sandbox Code Playgroud)

不幸的是,我遇到了可怕的错误:

irb(main):089:0> valid_yaml_string?("b")
Psych::SyntaxError: (<unknown>): mapping values are not allowed in this context at line 6 column 19
from /home/kentos/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/psych.rb:203:in `parse'
from /home/kentos/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/psych.rb:203:in `parse_stream'
from /home/kentos/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/psych.rb:151:in `parse'
from /home/kentos/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/psych.rb:127:in `load'
from (irb):83:in `valid_yaml_string?'
from (irb):89
from /home/kentos/.rvm/rubies/ruby-1.9.3-p374/bin/irb:12:in `<main>'
Run Code Online (Sandbox Code Playgroud)

ruby yaml

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

从给定日期开始每隔14天获取一个数组

在红宝石中,我怎样才能获得一年中的每一个第14天,从日期开始向后和向前.

所以考虑我今天,2015年6月16日收到2周的回收费用.如何根据该日期获得今年每个回收计费日的数组.

ruby

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

标签 统计

ruby ×2

ant ×1

javafx ×1

yaml ×1