java

Using System Properties in Java

Hi, I have a question on using System Properties in Java. Some classes like Authenticator require that we set the system properties regarding Proxy settings and than verify whether the Proxy was valid or not. My question is should I remove the Set Properties after I am done using it ? There are other parts of programs that might be us...

Java - open existing file or create one if doesn't exist using IO streams

I was following instructions from a Java website (http://java.sun.com/docs/books/tutorial/essential/io/file.html#createStream) on creating or writing a file using an IO stream. However, the code it provides seems to be broken in multiple places: import static java.nio.file.StandardOpenOption.*; Path logfile = ...; //Convert the string...

Need a way to search mail for a message id using imap

Hi, I am using Java Mail api to access a gmail account (not fixed). I need to search all mails for a given Mail id (). The search should terminate on the FIRST occurence of the message with given ID (Optimization : only a single mail should exist with the given id) i would of course would like to skip the "All mail" folder. The simples...

Is there a simple way to do Query By Example in iBATIS?

I had hoped this was baked into the most recent release, but if it is, I can't find the docs via a simple Google search. Failing that, I'd prefer a simple library, but I'll settle for a tutorial. Thanks. ...

How to identify which function call threw a particular exception in a try block?

Let's say there are three consecutive function calls in one try block and all of them throw the same type of exception. How can i figure out which function call threw the caught exception when handling it? ...

Java: Using an actionlistener to call a function in another class on an object from that class

Basically what I want to do is get a start button to initiate a method running in another class and acting on another object. My code for the listener: button1a.addActionListener(new ActionListener() { public void actionPerformed (ActionEvent event) { // Figure out how to make this work //sim.runCastleCrash(); } }...

how is this a static reference?

package gui; public class Solver { void solveIt(){ CubeGui.moveThat(); } } I am trying to access method moveThat from this class, but it keeps telling me cant access non static method moveThat from a static reference. I don't see how this is a static reference? ...

What is the replacement of "amazon-a2s-2007-10-29-java-library.jar" ?

Does any body know what will be the replacement of this existing jar? Is there a latest jar in place of this? Since the 15th of August signed request has become mandatory. ...

Properties File listener in Java?

I have properties file. I want to use listeners. if some Values change in this file then i want to update my integers. So, Which classes or implements do i need to use? ...

can constructors actually return Strings?

Hi all, I have a class called ArionFileExtractor in a .java file of the same name. public class ArionFileExtractor { public String ArionFileExtractor (String fName, String startText, String endText) { String afExtract = ""; // Extract string from fName into afExtract in code I won't show here return afExtract; } Howeve...

Has anybody used waf to build Java Applications?

Has anybody used successfully waf for building java applications? Preferably on Jython? Maybe with ivy integration? ...

[JAXB] Add XML comments into marshalled file

Hi. I'm marshalling object into xml file. How to add comments into that file? ...

Lazy Hibernate JPA using SOAP

I have a bunch of annotated, interrelated POJOs that I want to create/modify/search over SOAP. I made a utility to eagerly load every detail of each POJO and create an XML string so I can send the entire POJO graph as a search result. Even though the graphs are very small (less than three nodes), the eager loading took a very long time...

Netbeans JTree Linestyle

I'm having difficulties removing the "lineStyle" lines in JTrees using Netbeans. In a standalone program, I'm able to do this: JTree myJTree = new JTree(); myJTree.putClientProperty("JTree.lineStyle", "None"); JScrollPanel myScrollPanel = new JScrollPanel(); myScrollPanel.setViewportView(myJTree); But when I try addi...

how to parse xml document in java using SAX approach

i want to parse a file which is similar to a HTML file . Its not exactly a html file.It can contain some user defined tags. I dont know in advance how the tags are nested in one another in advance.The tags may also have attributes. I think i shold use a SAX parser. Does java have a inbuilt SAX . Can i call a function when i encounter eac...

What is the preferred way to load a DLL on an Eclipse RCP plugin?

I have an Eclipse RCP plugin that requires a DLL. What is the recommended best practice to add the DLL reference to the MANIFEST? Where should the DLL be located, what is the recommended directory name? I have read conflicting practices. Some ask you to create a folder with the architecture and processor type, some ask to set some pla...

Get task manager list via SWT?

Is there a way using SWT to get a list of all processes currently running (similar to executing tasklist.exe/tlist.exe on Windows)? If so, is there sample code available? Ideally this would be done programmatically only (no third party tools). My app monitors the process list and needs to support Windows 2000/Server 2003/XP Home/XP Pr...

Compare two dates with JPA

Hello everybody, I need to compare two dates in a JPQL query but it doesn't work. Here is my query: Query query = em.createQuery("SELECT h FROM PositionHistoric h, SeoDate d WHERE h.primaryKey.siteDb = :site AND h.primaryKey.engineDb = :engine AND h.primaryKey.keywordDb = :keyword AND h.date = d AND d.date <= :date ORDER BY h.date DES...

Correct way to initialize HashMap and can HashMap hold different value types?

So I have 2 questions about HashMaps in Java: (1) What is the correct way to initialize a HashMap? I think it might be best in my situation to use: HashMap x = new HashMap(); But Eclipse keeps suggesting that I use: HashMap<something, something> map = new HashMap(); which is better? (2) Can a HashMap hold different types of objec...

How to handle a GUI of an external software from within Java code

Hi there, I need to run an external application from within my Java code. I can run the application with Runtime r = Runtime.getRuntime() and then r.exec(...), however, this brings up the GUI of the application. And I still need enter some settings in some fields and press enter. So: Is there some way to handle a GUI (filling out field...