在我的Applet中加载DLL库

当我尝试在服务器上运行我的applet时,它似乎永远不会出现第一步,即加载库,当我尝试在localhost上运行时,工作完美 码 private final static String DEFAULT_DOWNLOAD_PATH = “http://colorfulwolf.com/dev/cam/”; private final static String VERSION_ID = “1.0.0”; // note that this list is windows-specific, so this is not a generic // solution that works on all OSes private final static String[] LIBS = { “cv210.dll”, “cvaux210.dll”, “cxcore210.dll”, “cxts210.dll”, “highgui210.dll”, “ml210.dll” }; private final static String LIB_ARCHIVE […]

Java没有其他类的响应

我有这个GUI程序,我试图基本上复制Windows CMD。 由于我在这个程序中有很多function,所以我决定将部分代码放在不同的类中。 但它没有回应。 if(command.size()0) { switch(command.get(0)) { case “dt”: getDateTime a = new getDateTime(); a.Start(); break; // other case(s) down below } } 这是geDateTime类 public class getDateTime { public static void Start() { Terminal t = new Terminal(); try { DateFormat dateFormat = new SimpleDateFormat(“dd/MM/yyyy HH:mm:ss”); Date date = new Date(); String s = […]

Java导入包(包装在上面的工作目录上)

如何在Java中导入包(在当前工作目录上面打包)? 这是目录结构: Coba.java import halo.*; public class Coba { public static void main(String args[]) { Orang org = new Orang(); System.out.println(org.a); } } Orang.java package halo; // I can’t import kabar.*; since it’s above present work directory public class Orang { public int a; public Orang() { this.a = 1; } public void haha() { […]

显示空视图后,filter列表不再出现

出于某种原因,在显示没有匹配项目的空视图后,从搜索视图中删除所有文本后,我的列表视图将不会再次出现。 在我的适配器类中, .clear()中的AFAIK mData.clear(); 需要改变别的东西,但我不知道该怎么做。 ItemListAdapter类 public class ItemListAdapter extends BaseAdapter implements Filterable { private List mData; private List mFilteredData; private LayoutInflater mInflater; private ItemFilter mFilter; public ItemListAdapter (List data, Context context) { mData = data; mFilteredData = new ArrayList(mData); mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } @Override public int getCount() { return mFilteredData.size(); } @Override public […]

Thymeleaf没有显示弹簧控制器的值

我是第一次练习百里香模板引擎。 我已经按照教程等等,但我不知道我哪里出错了。 我的控制器: public String mainPage(Model model){ model.addAttribute(“data”, “Hello Thymeleaf”); return “main”; } 我的HTML如下: th:text=”${data}” 当我点击localhost时,它显示th:text =“$ {data}”而不是Hello Thymeleaf “${data}” 也不起作用。 查看解析程序配置必须正确,因为它将main解析为main.html。 我正在使用spring4 SpringTemplateEngine和spring4百万美元视图解析器。 提前致谢

Jsp页面给了我一个List,但是我的类想要一个Set

我有一个名为Menu的类,其中包含一个名为voceMenuList的字段,其中包含“Home”,“contact”等菜单项。 public class Menu implements Serializable{ private Set voceMenuList; public void setVoceMenuList(Set voceMenuList) { this.voceMenuList = voceMenuList;} public Set getVoceMenuList() { return voceMenuList;} } 这是我的jsp页面,我在输入文本中打印对象VoceMenu的字段,以便编辑该值 … URL … 当我发布页面时,我收到以下错误,可能是因为jsp页面返回一个List,但是我的类期望一个Set。 我该如何解决这个问题? 谢谢 org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.beans.InvalidPropertyException: Invalid property ‘voceMenuList[0]’ of bean class [com.springgestioneerrori.model.Menu]: Getter for property ‘voceMenuList’ threw exception; nested exception is […]

在Hibernate 3.2中使用连接池(c3p0-0.9.1.2)时,获取exception和应用程序无法与MySqL数据库连接?

我正在使用连接池(c3p0-0.9.1.2)和Hibernate 3.2,如下所示:hibernate.cfg.xml org.hibernate.dialect.MySQLDialect com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/bspersonaltrainer root admin thread org.hibernate.cache.NoCacheProvider org.hibernate.connection.C3P0ConnectionProvider 2 400 50 600 300 false 但我经常得到这个例外。 Exception in thread “com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1” java.lang.NoClassDefFoundError: com/mysql/jdbc/SQLError at com.mysql.jdbc.Util.handleNewInstance(Util.java:430) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:302) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:282) at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134) at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182) at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137) at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014) at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32) at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810) at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547) Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.SQLError at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526) … 11 […]

不可变的番石榴collections品的缺陷?

我不确定我理解的不可变集合的缺陷是否正确,所以我在这个答案中列出它们。 希望有人在这里纠正我。 a):与Collections.unmodifiableXXX()相比,ImmutableXXX.copyOf() 丢失了源集合function 。 例如,当将linkedList放入ImmutableList.copyOf()时,不再链接ImmutableList。 与基于树的集合相同。 b):人们认为Collections.unmodifiableXXX只使用相同的源集合引用,因此一旦源集合发生更改,Collections.unmodifiableXXX也会更改。 但我的解决方案是将源集合包装到临时集合中,该集合传递给ImmutableXXX.copyOf()。 见下面的代码: List l = new ArrayList(); List unmodifiableList = Collections.unmodifiableList(l); ImmutableList immutableList= ImmutableList.copyOf(l); l.add(“a”);//unmodifiableList is also added “a”, immutableList not. /*My solution as follows: So unmodifiableList2 is also immutable as ImmutableList.copyOf(l) does*/ List unmodifiableList2= Collections.unmodifiableList(new ArrayList(l)); 您对Immutable系列的理解是什么? 谢谢!

使用JAXB编组/解组Java超类和子类

我一直在试验JAXB教程,并设法让代码工作,从Java对象生成XML文件,然后能够使用XML生成Java对象。 目前,它会读取同一个类的多个实例,以创建类似于下面的XML文件 TR54 red 5 BN04 THY yellow 3 BN05 THY yellow 5 我希望能够使用JAXB技术来处理子类。 例如:假设我有一个Car,Van和Bicycle对象是Vehicle的子类。 我是否可以操作我的JAXB类来编写一个XML文件来生成与此类似的东西? 我已经提供了我正在使用的代码。 TR54 red 5 MN05 RFD red 5 ZX54 UJK red 1 主类 package basictransport2; public class Main { public static void main(String[] args) { JAXB parser = new JAXB(); parser.marshall(); //parser.unmarshallList(); } } 车辆类 package basictransport2; import javax.xml.bind.annotation.XmlElement; […]

黑莓HTTP连接问题

我有一个简单的应用程序编写连接到Web服务(restful)。 该应用程序在黑莓模拟器上工作正常但是我在黑莓9300上使用它时遇到了问题。 当应用程序尝试调用Web服务时,我不断收到错误“java.io.ioexception:tunnel down”。 我正在调用的服务是一个简单的HTTPpost,我试图通过WIFI运行它(WIFI连接正常用于浏览互联网)。 我正在使用连接字符串“http://127.0.0.1:8080/test/restws;interface=wifi”,IP地址已更改为我正在呼叫的服务器的实际IP地址。 我可以在我的笔记本电脑浏览器上调用此服务器上的restful web服务。 我使用的代码类似于下面的&在模拟器上工作正常。 在模拟器和手机上的代码之间唯一改变的是连接字符串(使用“interface = wifi”与“deviceside = true”相反) 这是代码问题还是我需要在手机上更改的设置? 关于我需要做些什么才能克服这一点的想法。 谢谢 StreamConnection s = (StreamConnection) Connector .open(connectionString); httpConn = (HttpConnection) s; httpConn.setRequestMethod(“POST”); httpConn.setRequestProperty(“Content-Length”, Integer.toString(postData.length())); OutputStream output = httpConn.openOutputStream(); output.write(postData.getBytes()); output.flush(); output.close(); String response = httpConn.getResponseMessage(); int statusCode = httpConn.getResponseCode(); if (statusCode != HttpConnection.HTTP_OK) { } InputStream is = httpConn.openInputStream(); […]