java

Best Open Source Java CMS

I'm trying to find a good Java cms, I've stumbled uppon some that are quite good like: Apache Lenya, dotCMS, Info Glue, Open Edit, MMBase, Contelligent, Hippo CMS Which on do you guys recommend, or even one that I'm missing, because I have some more that I am studying at the moment. The requirements are that I can build modules for it...

Conveniently move a class to a different package in eclipse without borking svn

When moving a file from old.package to new.package I want two things to happen: Update all references to that class (in all files of the project) so that the new package is used svn move old/package/Foo.java new/package/Foo.java I use subversive within Eclipse Ganymede. When I just drag the file from one package to the other, all ref...

How do I avoid unwanted log messages on java project?

On my java project, I have a bunch of strings externalized on a messages.properties file. On its respective Messages.java file I had the same number of public static String-typed attributes, so I could access those externalized texts. Then, I implemented a method called getString, which receives the name of the constant as its argume...

difference between compare() and compareTo()

What is the difference between compare() and compareTo() methods in java? Both methods give same answer?Please give some examples. ...

How do I ensure Schema Extensibility using JAXB

If I am using JAXB as part of Metro Web Services under Glassfish v2, how do tell JAXB to add: <xsd:any/> and <xsd:anyAttribute/> tags to my generated complex types so that if I make changes in the future to add elements or attributes to my response objects then my current clients won't break. JAXB documentation seems somewhat lacki...

Accessing .NET/dll libraries/components from Java?

Are there inexpensive or free gateways from .NET to Java? I'm looking at some data acquisition hardware which has drivers for C/C++ and .NET -- I really don't want to do any programming in .NET. Update: I haven't done what I originally wanted to do, but I've done something similar, using JNA to encapsulate some functions from a DLL, in ...

What is a good use case for static import of methods?

Just got a review comment that my static import of the method was not a good idea. The static import was of a method from a DA class, which has mostly static methods. So in middle of the business logic I had a da activity that apparently seemed to belong to the current class: static import some.package.DA.*; class BusinessObject { voi...

java package name convention failure

I'm just coming up the learning curve for Java SE & have no problem with the usual Java convention for package names, e.g. com.example.library_name_here.package_name_here Except. I've been noticing a failure to abide by this in some fairly well-known packages. JLine: jline.* JACOB: com.jacob.* (there is no jacob.com) JNA: com.sun...

how to convert a string to RegularTimePeriod in java?

I am using Jfreechart. I have the code like this TimeSeries t1 = new TimeSeries("EUR/GBP"); t1.add(new Day(4, MonthConstants.JANUARY, 2001), new Double(1.5807)); But I get String from my SQL query. TimeSeries accepts only RegularTimePeriod or TimeSeriesDataItem. Please let me know how to convert a String into RegularTimePeriod. Thank...

How do I login and download a file from a https web page from Java?

Hi, I have to login into a https web page and download a file using Java. I know all the URLs beforehand: baseURL = // a https URL; urlMap = new HashMap<String, URL>(); urlMap.put("login", new URL(baseURL, "exec.asp?login=username&pass=XPTO")); urlMap.put("logout", new URL(baseURL, "exec.asp?exec.asp?page=999")); urlMap.put("file", new...

In Java, how do i find the caller of a method using stacktrace or reflection?

I need to find the caller of a method. Is it possible using stacktrace or reflection? ...

Java- How can you set a pane's background with an image?

I'm wondering if there is any way to set a JPanel's background to an image instead of just a colour. Thanks and I'm working on dr. java ...

How to safely update a file that has many readers and one writer?

I have a set of files. The set of files is read-only off a NTFS share, thus can have many readers. Each file is updated occasionally by one writer that has write access. How do I ensure that: If the write fails, that the previous file is still readable Readers cannot hold up the single writer I am using Java and my current solution...

Swing buttons don't react immediately! How can I change that?

Hey guys! I've built a form with Netbeans's visual editor. When I press one of the buttons it should do the following : set it to disabled perform a task that takes some time when the task finishes the button will be enabled again However, the following happens: the button remains in a pressed state until the task finishes when th...

Good choice for a lightweight checksum algorithm?

Hi all, I find myself needing to generate a checksum for a string of data, for consistency purposes. The broad idea is that the client can regenerate the checksum based on the payload it recieves and thus detect any corruption that took place in transit. I am vaguely aware that there are all kinds of mathematical principles behind thi...

Finding running instances in a running JVM

I'm wondering if it's possible to get a handle on running instances of a given class. The particular issue that triggered this was an application that doesn't exit nicely because of a number of running threads. Yes, I know you can daemonize the theads, and they won't then hold up the application exit. But it did get me to wondering if ...

What is a lightweight way to monitor a network adapter in Java?

I want to be able to detect when a computer connects to a network. The environment is Java 5 under Windows. ...

Simple/elegant way to do object to object transformation in Java?

I have to take over and improve/finish some code that transforms Java objects from a third party library into internal objects. Currently this is done through a big if-else statement along the lines of: if (obj instanceOf X) { //code to initialize internal object } else if (obj instanceOf Y) { //code to initialize different obje...

When using Java's FileLock, is it ok to let close() to automatically do a lock.release()?

As most should know close() also closes any streams uses. This allows the follow code: BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(...))); ... br.close(); This is nice, since we don't need a reference to FileInputStream and remember to close it. But does it also work for FileLocks? final FileInp...

How to create hyperlink in Spring + JSP

What's the proper way to create a hyperlink in Spring+JSP? There must be a better way than just coding in the <a href="..."> tag. Take for example a page that displays people. The URL is people.htm. The corresponding controller gets people from the database and performs optional column sorting. The JSP might look like: <table> <tr> <t...