小编Bis*_*128的帖子

Android - 找不到命令

我试图在ubuntu中运行该命令

android更新项目--path.

但是我得到了一个 android:command not found error.

我认为这与我前几天在这里学到的路径有关?我只是想知道,我需要添加什么变量(Android我假设)以及我需要指出什么.

linux android classpath

46
推荐指数
3
解决办法
7万
查看次数

我们应该使用clone还是BeanUtils.copyProperties以及原因

从它的外观 - BeanUtils.copyProperties似乎创建一个对象的克隆.如果是这种情况,那么关于实现Cloneable接口的问题(只有不可变对象是新的,因为可变对象有复制的引用)这是最好的,为什么?

我昨天实现了cloneable,然后意识到我必须为非String/Primative元素提供我自己的修改.然后我被告知BeanUtils.copyProperties我现在正在使用哪个.两种实现似乎都提供了类似的功能.

谢谢

java spring clone

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

无法阻止Hibernate将日志写入控制台(log4j.properties没问题)

我已经准备好了

<property name="show_sql">false</property>
Run Code Online (Sandbox Code Playgroud)

我已经禁用了log4j.properties中的所有消息

但是Hibernate使用所有查询和语句写入控制台.

java orm hibernate

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

在maven配置文件中设置系统变量

是否可以在maven中设置可从java类中获得的系统属性.

我已经看到这可能(这里)在surefire插件中如下;

String param = System.getProperty("my_parameter1");

<configuration>
    <systemPropertyVariables>
        <my_property1>${my_property1}</my_property1>
    </systemPropertyVariables>
</configuration>
Run Code Online (Sandbox Code Playgroud)

但是,我想了解我正在处理的环境,我已经将prod或dev作为maven profile参数传递 - 是否有可能通过在配置文件中设置变量来获取代码中的句柄我调用然后调用system.getProperty或其他方式?

谢谢

我的pom文件

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>core</groupId>
    <artifactId>core</artifactId>
    <version>1.0</version>
    <packaging>jar</packaging>
    <build>
        <sourceDirectory>src</sourceDirectory>
        <testSourceDirectory>test</testSourceDirectory>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    <warSourceDirectory>WebContent</warSourceDirectory>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.17</version>
                <configuration>
                    <parallel>methods</parallel>
                    <threadCount>10</threadCount>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>sonar-maven-plugin</artifactId>
                <version>2.1</version>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src</directory>
                <excludes>
                    <exclude>**/*.java</exclude>
                </excludes>
            </resource>
            <resource>
                <directory>resources</directory>
                <includes>
                    <include>**/*.png</include>
                </includes>
            </resource>
        </resources>
    </build>
    <dependencies> …
Run Code Online (Sandbox Code Playgroud)

java environment-variables maven

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

ActiveMQ连接被拒绝

我试图activemq在我的应用程序中使用,但在尝试连接到localhost时不断收到错误:

log4j:WARN No appenders could be found for logger (org.springframework.core.env.StandardEnvironment).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" org.springframework.jms.UncategorizedJmsException: Uncategorized exception occured during JMS processing; nested exception is javax.jms.JMSException: Could not connect to broker URL: tcp://localhost:61616. Reason: java.net.ConnectException: Connection refused
    at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:316)
    at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:168)
    at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:469)
    at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:534)
    at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:526)
    at sender.MessageSender.sendMessage(MessageSender.java:16)
    at sender.SenderMain.main(SenderMain.java:13)
Caused by: javax.jms.JMSException: Could not connect to broker URL: tcp://localhost:61616. Reason: java.net.ConnectException: Connection …
Run Code Online (Sandbox Code Playgroud)

java activemq-classic

18
推荐指数
2
解决办法
8万
查看次数

为什么属性改变了监听器而不是可观察的

我遇到了类设计的问题,直到我发现了observable(使用观察者设计模式)并因此创建了一个使用它的小应用程序来解决我的问题.我很高兴和自豪,我用一个好的原则来解决问题.

现在我即将开始我的主要应用程序,并刚刚阅读此内容

制作JFrame和Observable对象

为什么海报建议不要使用observable而是告诉使用propertychangelistenr?使用observable有什么问题吗?

问候

java swing design-patterns

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

Session.getInstance的Java Mail问题

我在尝试使用java邮件时收到以下异常;

java.lang.NoClassDefFoundError: com/sun/mail/util/MailLogger
    at javax.mail.Session.initLogger(Session.java:226)
    at javax.mail.Session.<init>(Session.java:210)
    at javax.mail.Session.getInstance(Session.java:247)
    at com.secondstory.mailsender.MailSender.createSmtpSession(MailSender.java:67)
    at com.secondstory.mailsender.MailSender.sendSimpleMessage(MailSender.java:38)
    at com.secondstory.mailsender.MailSender.generateLostPasswordEmail(MailSender.java:79)
    at com.secondstory.mailsender.MailSenderTest.shouldReturnTrueWithCredentialsSet(MailSenderTest.java:49)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.ClassNotFoundException: com.sun.mail.util.MailLogger
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at …
Run Code Online (Sandbox Code Playgroud)

java jakarta-mail noclassdeffounderror

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

Raspberry pi闪烁LED问题 - Python与Java

我正在尝试使用我在网上找到的一些代码在树莓派上制作LED灯闪光(我知道 - 不是最好但是它是一个教程网站)

当我运行以下python代码时,LED指示灯闪烁;

import RPi.GPIO as GPIO
import time
pinNum = 4
GPIO.setmode(GPIO.BCM) #numbering scheme that corresponds to breakout board and pin layout
GPIO.setup(pinNum,GPIO.OUT) #replace pinNum with whatever pin you used, this sets up that pin as an output
#set LED to flash forever
while True:
  GPIO.output(pinNum,GPIO.HIGH)
  time.sleep(0.5)
  GPIO.output(pinNum,GPIO.LOW)
  time.sleep(0.5)
Run Code Online (Sandbox Code Playgroud)

当我运行以下应该执行相同操作的Java代码时 - 所有我到达控制台的是我添加的打印语句 - 没有闪烁的灯光

import com.pi4j.io.gpio.GpioController;  
 import com.pi4j.io.gpio.GpioFactory;  
 import com.pi4j.io.gpio.GpioPinDigitalOutput;  
 import com.pi4j.io.gpio.PinState;  
 import com.pi4j.io.gpio.RaspiPin;  

 public class ControlGpioExample {  
  public static void main(String[] args) throws InterruptedException {  
     final GpioController …
Run Code Online (Sandbox Code Playgroud)

python java raspberry-pi

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

声纳属性文件

我有一个具有以下包结构的项目

src/main/proj
    -com.company.package
        -appName
            -morepackages

        -appVersion2
            -morepackages

sonar-runner.properties
sonarBuild.sh
sonar-runner-project2.properties
sonarBuildProject2.sh
Run Code Online (Sandbox Code Playgroud)

按照目前的情况,使用默认属性文件,我可以运行声纳报告,它将生成整个项目的评论

sonar.projectKey=KEY
sonar.projectName=PROJNAME
sonar.projectVersion=1.0

sonar.host.url=someurl

#Path for sonar sources
sonar.sources=src/main/java

#Path for libraries
sonar.libraries=target/lib/*.jar

#Path for binaries
sonar.binaries=target/classes

#--------Default database
sonar.jdbc.url=someurl
sonar.jdbc.driver=com.mysql.jdbc.Driver

#----- Global database settings
sonar.jdbc.username=sonar
sonar.jdbc.password=sonar

#----- Default directory layout
sonar.java.source=1.6
sonar.java.target=1.6

sonar.sourceEncoding=UTF-8
Run Code Online (Sandbox Code Playgroud)

理想情况下,我想将两个报告分开,所以我有一个用于原始包,一个用于appVersion2包.现在 - 如上所述,我为每个人创建了一个单独的属性文件.我应该只指向sonar.sources要分析的每个作业的相应包,还是有更好的方法在一个属性文件中执行此操作?

谢谢

编辑

我的多模块尝试属性文件如下所示

sonar.projectKey=rootkey
sonar.projectName=rootname
sonar.projectVersion=1.0
sonar.host.url=rooturl
sonar.sources=src/main/java/
sonar.libraries=target/lib/*.jar
sonar.modules=module1,module2
sonar.sourceEncoding=UTF-8

#----- Global database settings
sonar.jdbc.username=user
sonar.jdbc.password=pass

sonar.java.source=1.7
sonar.java.target=1.7


#--------Default database
sonar.jdbc.url=url
sonar.jdbc.driver=com.mysql.jdbc.Driver


module1.sonar.projectName=proja
module2.sonar.projectName=projb

module1.sonar.projectKey=projakey
module2.sonar.projectKey=projbkey

#Path for …
Run Code Online (Sandbox Code Playgroud)

java sonarqube

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

将JAXB映射到数据库表的最佳方法

我有一个入站xml,我使用xjc工具映射到JAXB对象(构建pojos)

我想知道将这些对象映射到各种表的最佳方法是什么.

一个Object/Xml可以映射到多个表,我认为这些表规则是hibernate.作为一个基本的解决方案,我相信我需要在某种程度上注释对象中的字段(通过xsd中的标签?我不知道)到数据库列名.

有没有人遇到过这个?

谢谢

java xml database jaxb

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