java

pre-compile jsp files happend exceptions

I pre-compile some jsp files through ant task of jspc,but it built failed. errers: info.jsp(35,2) The attribute prefix fn does not correspond to any imported tag library info.jsp line 35 : <c:if test="${fn:length(requestScope.checkDetailInfoList) gt 1}"> ant task xml: <jasper validateXml="false" uriroot="${basedir}/WebRoot" ...

spring - config spring email

I used the springmail to send email from my smtp server with the following config: <bean id="springEmailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl"> <property name="defaultEncoding" value="UTF-8"/> <property name="host" value="mail.myserver.com"/> <property name="port" value="25"/> <property name="username"...

Under what conditions will BlockingQueue.take throw interrupted exception?

Let us suppose that I have a thread that consumes items produced by another thread. Its run method is as follows, with inQueue being a BlockingQueue boolean shutdown = false; while (!shutdown) { try { WorkItem w = inQueue.take(); w.consume(); } catch (InterruptedException e) { shutdown = true; } } ...

how to retrieve corresponding xpath

I would like to know about how to retrieve corresponding xpaths when we input an xml file in java with eclipse platform. For example, <document> <name>xml file</name> <size>12 kb</size> </document> the result is: /document /document/name /document/size ...

Why do you name the class twice during instantiation with java?

I'm new to java, and this question struck me. When you instantiate an object, why do you specify the class twice? OddEven number = new OddEven(); Why can't you just say number = new OddEven();? When I delcare a string, I only say String once: String str = "abc"; Actually, my question is not "why do you do it this way" -- obviously...

How do I log every time I start an application in Windows?

I'd like to log or record every time I start an application to gain insight into which applications I use most on my Windows system. I was thinking I could create an event in the event log and listen for it in a .Net program. Questions: Is this the best way to solve this problem? If so, which .Net library should I use? I am also ope...

Which eclipse version to use on a Mac? (Carbon or Cocoa)

When i go to the eclipse website (http://www.eclipse.org/downloads/) there are 3 different versions of eclipse for Mac: Carbon 32bit Cocoa 32bit Cocoa 64bit I'm confused about why there are three version and which one i should be using. (I'm running OSX 10.5 on a MBP) ...

Record Keystrokes outside of the application

Recently I made an autoclicker for a game, which would allow you to use F1 and F2 to turn it on or off, once I finished the application I thought to myself, "oh great, I forgot Java doesn't let you record outside keystrokes and mouse movements", is there any simple non-native ways to do this? Thanks. ...

JDO not fetching collection member field.

Hi Have a class: class Node implements Serializable { private String name; public String getName { return name; } public void setName(String val){ name = val; } public Node(){} } @PersistenceCapable(identityType = IdentityType.APPLICATION, detachable="true") class NodeBag implements Serializable { @PrimaryKey ...

Java NoClassDefFound Errors

I'm running into a problem with a java app constantly throwing: java.lang.NoClassDefFoundError: Could not initialize class java.net.ProxySelector. I am running Suse Linux 10.3 and running java 1.6.0. My CLASSPATH is set to /usr/lib/jvm/jre-1.6.0-openjdk/lib. No other users seem to be having this error so I'm assuming its my ...

Is it better to use an in-memory database (e.g. SQLite) than to keep everything in HashMap or other data structures?

I need to have very fast access to a big Map - several millions of entries. Is it worth using an SQLite in-memory database to keep that map as opposed to just having that HashMap in memory? ...

In java JMonkeyEngine, public GameSettings getNewSettings()? How do I fill it out?

I'm trying to change a BaseGame to a FixedFrameRateGame, and It's saying I need a public GameSettings getNewSettings() method. Now I tried filling out like this: public GameSettings getNewSettings(){ return null; } it gives me a nullpointerexception when I try to run it. ...

Proper use of Arraylist and Java Generics vs Vectors

I have been using vectors in the past and am very familiar with them. I have heard that ArrayLists are faster and more flexible. I am new to using ArrayLists and Java Generics. I am currently using them as follows and receiving a warning about parametrization (Which I thought I did by declaring them <String>. ArrayList<String> arrayList...

hibernate Lock wait timeout exceeded;

I am using hibernate, trying to simulate 2 concurrent update to the same row in database. Edit: I moved em1.getTransaction().commit to be right after em1.flush(); I am not getting any StaleObjectException, the two transactions committed successfully. Session em1=Manager.sessionFactory.openSession(); Session em2=Manager.sessionFactory....

checking empty string in java

Hi Geeks, I dont know whats the wroing with the below code.... I am getting input from textbox and putting the input in a string. If the textbox is empty it will return a empty string. In the below code String[] str = new String[9]; for(int i=0;i<9;i++){ if(str[i].equals("")){ System.out.println("set " + cmds[i]...

Best OpenID library for Java

I want users to be able to log into my website with OpenID, but I don't know which library to use. I know which ones are out there, but I would like to know which one would be best. I'm running JOnAS, but no web framework (no Spring, Struts, GWT, etc.). (Please don't chastise me for not using a web framework. I have my reasons.) For...

how do i clear my frame screen in java?

I am making a brick game. I want the screen to get clear after every 0.1 second so that i can redraw every thing on the frame screen. Is there any way to directly clear the frame screen without any event occurence?? ...

Enterprise Library DAAB for JAVA?

Hi, I'm looking for a java library thats similar to .NET's Enterprise Library specifically the Data Access block. More details.. working on a java poc and would like a library to build the data access.. no ORM's or something too complicated. The library should be able to use MsSQL as a database. ...

Can I have a Interface in method?

I know that that on can have a class declaration in a method of class. Eg. We can have anonymous class declaration for event handling in a method body. But I want to know that same way can I have Interface declaration in a method in a class. What is use of that? ...

How to remove &amp; from an XML file using java?

Hi, I am reading the input Excel file and in that i have 1 fields for the address.In that field the special character is coming which is (&).While i am going to parse this character (&) and trying to write it to the XML file at that time the character converts into the (&amp). I want to remove the translated character (&amp) from the X...