我刚开始在Linux上编写/测试JavaFX的东西,我在创建一个简单的应用程序时遇到了错误.在Foruns,我发现许多人对此有所了解,但我能找到一个明确的解释,说明它发生的原因.我想了解我的方案中缺少什么才能使其正常工作.
任何建议都会真正贬值.
java version "1.8.0-ea"
Java(TM) SE Runtime Environment (build 1.8.0-ea-b123)
Java HotSpot(TM) Client VM (build 25.0-b65, mixed mode)
Linux MYServer 2.6.21-1.3228.fc7 #1 SMP Tue Jun 12 15:37:31 EDT 2007 i686 i686 i386 GNU/Linux
Run Code Online (Sandbox Code Playgroud)
Graphics Device initialization failed for : es2, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:300)
at com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:244)
at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:179)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:210)
at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:653)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:314)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:305)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at …
Run Code Online (Sandbox Code Playgroud) 异常消息抱怨重复键但显示值的原因是什么?
List<Employee> employees = new ArrayList<>();
employees.add(new Employee("John", 40));
employees.add(new Employee("John", 30));
Map<String, Integer> map = employees.stream()
.collect(Collectors.toMap(Employee::getName, Employee::getAge));
Run Code Online (Sandbox Code Playgroud)
它不显示"John"作为重复键,而是显示"40"
Exception in thread "main" java.lang.IllegalStateException: Duplicate key 40
(...)
Run Code Online (Sandbox Code Playgroud) 有人可以解释我或者指出一些文件,其中"if()......"和"if [] ......"之间的区别可以澄清吗?
我正在尝试解决这个"组合+泛型"情况,并使PostCompany.send(msg)与传递/注入类的类型兼容.
我可以更改什么以允许Fedex和FedexPlus在PostCompany类中用作泛型类型,因为Fexed的send方法需要String作为参数而FeexPlus需要Integer?
interface Poster<T> {
void send(T msg);
}
class Fedex implements Poster<String> {
@Override
public void send(String msg) {
// do something
}
}
class FedexPlus implements Poster<Integer> {
@Override
public void send(Integer msg) {
// do something
}
}
class PostCompany<P extends Poster> {
private final P poster;
public PostCompany(P poster) {
this.poster = poster;
}
public void send(??? msg) { // <-- Here
this.poster.send(msg);
}
}
Run Code Online (Sandbox Code Playgroud) 我的问题对于你们中的许多人来说应该很简单假设我有以下 SQL 并且我想使用正则表达式获取表名:
SELECT name, age FROM table1
Run Code Online (Sandbox Code Playgroud)
使用这个表达式我可以得到那个好的
Pattern p = Pattern.compile(".*FROM\\s+(.*?)($|\\s+[WHERE,JOIN,START\\s+WITH,ORDER\\s+BY,GROUP\\s+BY])", Pattern.CASE_INSENSITIVE);
Matcher result = p.matcher(pSql);
if (result.find()) {
lRetorno = result.group(1);
}
Run Code Online (Sandbox Code Playgroud)
但是,如果表名称包含架构名称(xyz.table1),我的表达式会带来一切。我的问题是......我需要对此查询进行哪些修改才能只返回没有架构/所有者的表名?
任何帮助将非常感激
拉斐尔·莫伊塔
我有一个 bash 脚本,在my-script.sh
从根目录向上 2 层的文件夹中调用,我希望从该文件夹中调用/执行该脚本
/folder1
/folder2/
- my-script.sh
- do-it.sh
Run Code Online (Sandbox Code Playgroud)
我的脚本.sh
#!/bin/bash
./do-it.sh
Run Code Online (Sandbox Code Playgroud)
如果我从根文件夹执行,它会失败,因为它尝试在同一文件夹中my-script.sh
查找。do-it.sh
folder1/folder2/my-script.sh: line 3: ./do-it.sh: No such file or directory
Run Code Online (Sandbox Code Playgroud)
如果我想正确执行 my-script.sh 脚本,我必须先进入folder2,然后他们执行它
cd /folder1/folder2
./my-script.sh
Run Code Online (Sandbox Code Playgroud)
有没有办法从根文件夹执行它,因为它是从folder2执行的?