java

jersey Viewable and c:import tag lib

Giver a resource class that has a method witch returns a Viewable (or generaly any jsp page). Is there a way to use the c:import or jsp:include taglib to include a Viewable response from a jaxrs anotatted class? For example given the class @Path("/some/path") public class SomeJaxrsResource { @GET public Viewable get() { return n...

What is the most efficient way to repeat an action every x minutes?

I have an application that runs in JBoss. I have an incoming web service request that will update an ArrayList. I want to poll this list from another class every 60 seconds. What would be the most efficient way of doing this? Could anyone point me to a good example? ...

Java Struts Report

I am writing an excel report using an action,controller, servlet struts framework. The report is very congested and has already around 10 separate queries. I need to add about 10 more queries due to a change in the report. Is there a way to do this without having to keep nesting the Result Sets? Below is the existing code. public TotalS...

Java Thread won't pause on I/O operation

I was under the impression that in Java, a Thread will pause and give other threads a chance to do some work during blocking I/O operations ( like Socket.read() or DataGramsocket.receive() ). For some reason in my multi threaded network application, a call to receive() is causing all my other threads to starve ( the thread that called re...

Problems calling a method from another Java class

I am having a runtime error that states Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at Status.copyState(Status.java:29) This is a class that is call the an instance of the Status calls (st): Main class is: import javax.swing.*; import java.awt.event.*; import java.awt.*; /** * * * @author (Jason Sizemor...

can't find file... using eclipse and file/filereader/bufferedreader

http://pastebin.com/m5fa7685e It seems to fail when getting f3.. Output is: not ready File is null Exception in thread "main" java.lang.NullPointerException at BuabFile.parseBUAB(BuabFile.java:93) at AddressBook.createBrowseForm(AddressBook.java:232) at AddressBook.(AddressBook.java:51) at Main.main(Main.java:4)" Bu...

Sending an Email Using Java

try{ Properties props = new Properties(); props.put("mail.smtp.host", "ipc-smtp.bits-pilani.ac.in"); Session sess = Session.getInstance(props, null); sess.setDebug(true); Message msg = new MimeMessage(sess); InternetAddress addressFrom = new InternetAddress("[email protected]"); msg...

MathML and Java

Hi all. I've been doing some research for a mathematical Android related project I'd like to embark upon and I stumbled across for the first time MathML. Does anyone know of any Java libraries which can do any (preferably all) of the following things? Parse MathML Output MathML by parsing standard mathematical notation Render MathML...

Unit testing icefaces

Can you separate components of an IceFaces application so they can be tested in isolation instead of using something like Selenium or HttpUnit on the assembled application? Backing beans can be easily isolated (if written to be testable) but I am interested in testing the template/display parts of the application while using as little o...

could not find the main class

Hi, I'm using the JDK 3.1. I am using XML Publisher. I'm getting this error: Could not find the main class. Program will exit. After I click on "OK", I get Java execution failed. Please check the Java Option in the option dialog ...

Can you specify generics type on map value?

In Java (5+) you can do: TreeMap<String, List> map = someObject.getMap(); But can specify the generic type within the List? A la: TreeMap<String, List<String>> map = someObject.getMap(); ?? ...

Why do I get a GSSException when using Active Directory SSO from Microsoft IE to a Java server?

I was building an Active Directory Single Sign-On authentication system for Java web applications (using SPNEGO/Kerberos), and everything works fine with either Firefox or (reportedly) Safari, but Internet Explorer causes an exception: GSSException: Channel binding mismatch (Mechanism level: ChannelBinding not provided!) In fact, I th...

IntelliJ getter/setter format

How can you get IntelliJ to generate getter/setters on one line like this: public String getAbc() { return abc; } Instead of public String getAbc() { return abc; } ?? ...

Writing GraphML with XOM?

I'm trying to write out a graphML document with XOM in java, but I can't figure out how to get all of the namespace declarations correct. To have valid graphML, I need to have a root element that looks like the following: <graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ...

jvm heap limit on SUSE

hello, I hope you can help me on the problem we have with SUSE and JDK 1.4.x: my suse is PAE enabled with 15Gb RAM. unfotunately jvm cannot allocate more than 1900Mb for heap size. So java -Xmx2048m gives me an error. it seems you had the same problem, did you solve it? I hope so :) thanks Michelangelo ...

How should I generate an initialization vector?

I'm sure there's not one answer to this question, but just trying to find out a general approach. Using Java 1.4.2, I need to generate a key and IV for use in a symmetric algorithm. These values will be pre-shared with the recipient through a secure channel. The key I can generate with KeyGenerator.keyGenerate(). But unless I'm missi...

How many times can classes be nested within a class?

I came across this questions on one of the online Java Tests. The options were 4,5,8 and any number of times. I have only used one inner class, but have never tried multiple ones. I was wondering if anyone knows the answer. ...

Specify time zone of log4j's date

Is it possible to specify the time zone that log4j will use? I need the dates in the log file to be a different time zone than the application's. log4j's PatternLayout uses SimpleDateFormat. Unfortunately there doesn't appear to be a way to control SimpleDateFormat's time zone via the pattern string (DateFormat has setTimeZone method but...

address book next and previous buttons

I'm making an address book and I need to cycle through my contacts. The contacts are imported from file and are read into the JTextFields as so: name phone mobile address How do I go about doing this? I've tried, it runs but the buttons do nothing. edit: now using this: public void importContacts() { try ...

Drag&Drop with swing

I need some help. Is it possible to simulate a drag & drop without registering a component? E.g. I click the mousekey anywhere on the window and hold the mousekey down, at this moment, I want to create or simulate a DragSourceEvent programmatically with Java. Is this possible? ...