如何从Java进程中更改Java进程的CLASSPATH?
在你问我之前"你为什么要那样做?" 我马上解释一下.
当你运行Clojure REPL时,通常需要在你的CLASSPATH中加入更多的jar来加载Clojure源文件,我想这样做而不必重新启动Clojure本身(在Slime上使用它时这不是一个真正的选择)在Emacs上).
这就是原因,但我不希望这个问题被标记为奇怪的语言奇怪的编辑器,并被大多数可能有答案的Java开发人员所忽视.
我在这种情况下发现自己两次:我在我的系统上安装了一个gem并开始在我的Rails项目中使用它.最终我需要对该gem进行一些更改.我该怎么办?
理想情况下,我想查看某个地方的宝石的源代码,比如〜/ third_party/gems,对它进行处理并让我的Rails项目使用它.那可能吗?
在所有情况下,宝石都在github,所以我可能会在github,克隆它,抓住机会并维护我自己的分支.我想我会在我的服务器上直接安装gem分支.那有意义吗?
我需要在Ruby中获取堆栈跟踪对象; 不要打印它,只是为了让它做一些录音和倾倒以供以后分析.那可能吗?怎么样?
你会如何提示用户输入一些信息但是在N秒后超时?
谷歌在http://mail.python.org/pipermail/python-list/2006-January/533215.html上指向了一个关于它的邮件线程,但似乎没有用.超时发生的语句,无论是sys.input.readline还是timer.sleep(),我总是得到:
<type'exception.TypeError'>:[raw_]输入最多需要1个参数,得2
以某种方式,除了没有抓住.
我正在调试为什么在module-info.java我的Spring Boot应用程序中,spring-orm在启动时抛出异常.这是例外:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/transaction/UserTransaction
at spring.beans@5.0.8.RELEASE/org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1699) ~[spring-beans-5.0.8.RELEASE.jar:na]
at spring.beans@5.0.8.RELEASE/org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:573) ~[spring-beans-5.0.8.RELEASE.jar:na]
at spring.beans@5.0.8.RELEASE/org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495) ~[spring-beans-5.0.8.RELEASE.jar:na]
at spring.beans@5.0.8.RELEASE/org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.8.RELEASE.jar:na]
at spring.beans@5.0.8.RELEASE/org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.0.8.RELEASE.jar:na]
at spring.beans@5.0.8.RELEASE/org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.8.RELEASE.jar:na]
at spring.beans@5.0.8.RELEASE/org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.8.RELEASE.jar:na]
at spring.context@5.0.8.RELEASE/org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1089) ~[spring-context-5.0.8.RELEASE.jar:na]
at spring.context@5.0.8.RELEASE/org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:859) ~[spring-context-5.0.8.RELEASE.jar:na]
at spring.context@5.0.8.RELEASE/org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.0.8.RELEASE.jar:na]
at spring.boot@2.0.4.RELEASE/org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.4.RELEASE.jar:na]
at spring.boot@2.0.4.RELEASE/org.springframework.boot.SpringApplication.refresh(SpringApplication.java:762) [spring-boot-2.0.4.RELEASE.jar:na]
at spring.boot@2.0.4.RELEASE/org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:398) [spring-boot-2.0.4.RELEASE.jar:na]
at spring.boot@2.0.4.RELEASE/org.springframework.boot.SpringApplication.run(SpringApplication.java:330) [spring-boot-2.0.4.RELEASE.jar:na]
at spring.boot@2.0.4.RELEASE/org.springframework.boot.SpringApplication.run(SpringApplication.java:1258) [spring-boot-2.0.4.RELEASE.jar:na]
at spring.boot@2.0.4.RELEASE/org.springframework.boot.SpringApplication.run(SpringApplication.java:1246) [spring-boot-2.0.4.RELEASE.jar:na]
at tech.flexpoint.dashmanserver/tech.flexpoint.dashmanserver.DashmanServerApplication.main(DashmanServerApplication.java:13) [classes/:na] …Run Code Online (Sandbox Code Playgroud) java java-platform-module-system spring-boot java-10 java-module
有一个包含模块和类名的字符串,例如:
"Admin::MetaDatasController"
Run Code Online (Sandbox Code Playgroud)
我如何获得实际课程?
如果没有模块,以下代码可以工作:
Kernel.const_get("MetaDatasController")
Run Code Online (Sandbox Code Playgroud)
但它打破了模块:
ruby-1.8.7-p174 > Kernel.const_get("Admin::MetaDatasController")
NameError: wrong constant name Admin::MetaDatasController
from (irb):34:in `const_get'
from (irb):34
ruby-1.8.7-p174 >
Run Code Online (Sandbox Code Playgroud) 我需要通过控制器中的代码关闭当前的fxml窗口
我知道stage.close()或stage.hide()在fx中执行此操作
如何在fxml中实现这个?我试过了
private void on_btnClose_clicked(ActionEvent actionEvent) {
Parent root = FXMLLoader.load(getClass().getResource("currentWindow.fxml"));
Scene scene = new Scene(root);
Stage stage = new Stage();
stage.setScene(scene);
stage.show();
}
Run Code Online (Sandbox Code Playgroud)
但它不起作用!
所有帮助将不胜感激.谢谢!
有没有办法从Ruby显示运行(shell)命令,但也捕获输出?也许借助一些宝石?
我所说的显示不是在最后打印它,而是在它出现时,所以用户得到运行慢命令时发生的事情的反馈.
有没有办法在显示帮助--help时使Python的optparse打印成为选项或标志的默认值?
有哪些方法可以使用Clojure中的数据库?
我从Clojure知道你可以用Java做任何事情,但这意味着我最终可能会使用与Clojure简单相冲突的过于复杂的东西(比如Hibernate).有什么建议或意见吗?
ruby ×4
java ×3
clojure ×2
python ×2
classpath ×1
database ×1
fork ×1
fxml ×1
gem ×1
java-10 ×1
java-module ×1
java-platform-module-system ×1
javafx ×1
optparse ×1
spring-boot ×1
stack ×1
stack-trace ×1
timeout ×1