java

JEditorPane Displaying HTML Dump

I am using a JEditorPane to display a series of links in response to a user query. The user can then click on these links to be taken to the original file or web page. This works just fine when the number of links is relatively small. However, when there is a lot of text in the JEditorPane, instead of displaying the nicely formatted l...

JVM Memory Defaults

What is the default Xms and Xmx settings for the Sun JVM (v 1.4*) if those values are not specified at startup? ...

How to start Tomcat with a specific server.xml under Windows?

Hello! I want to start Tomcat 6 with special configuration sometimes, not using the "server.xml". So I created another xml file named "server_test.xml". Now I want to tell tomcat to use this configuration. How is this done? I found nearly nothing searching the web. Only that: "Use different server.xml file in Tomcat configuration: ./t...

why collection [Person.companies] was not processed by flush() when using session ?

Hi, I am using grails 1.1.1 and i got this error collection [Person.companies] was not processed by flush() the configuration is as follow: Person domain has many companies (Company domain) while Company belongsTo Person then in the controller I did like this def person = session.person ; def jobs = Job.findByPerson(person); job...

Get Activity Monitor (Mac OSX) through Java

Is there a way using Java that I can gain a list of all active processes running on a Mac? I can do so in Windows using the code below to return the Task List, but that throws an exception on a Mac. I want my app to stop if certain applications are also running. Any ideas? Thanks. Windows Code: Process p = Runtime.getRuntime().exec...

App Engine: How to "reset" the datastore?

Whell, I'm developing in app engine (java) and after a lot of tries and deployments, I need to "reset" the datastore. There is a lot of random data I added to test performance, and besides that the entities changed a lot, so I need to delete all: data, tables, indexes. How can I do that? Thanks :) ...

Configure hibernate (using JPA) to store Y/N for type Boolean instead of 0/1

Can I setup JPA/hibernate to persist Boolean types as 'Y'/'N' in the database (the column is defined as varchar2(1)). It currently stores them as '0'/'1'. The database is Oracle. ...

Why parsing '23:00 PM' with SimpleDateFormat("hh:mm aa") returns 11 a.m.?

Finally I managed to understand what the problem was. I should hold on my string 11 PM instead of 23 PM What I don't understand is why parsing '23:00 PM' with SimpleDateFormat("hh:mm aa") returns 11 a.m.? My guess is it adds 12 hrs to the parsed date. I hope there is not much problem. ...

Java Socket Testing

I setup a Server on my machine that listens on port 8888 for incoming connections. Now I wanna make absolutely sure that this port is properly working and waiting for incoming connections. Is there maybe a tool I could use for Win XP that tells me if on my local machine there is an TCP port waiting for a connection? ...

Java + Scripting languages (JSR 223)

I'm designing a Framework which I want to attach to the scripting language API to make it more versatile and easier to use (for some things I really prefer the scripting way myself ;). With languages like JRuby, Jython or Rhino (JavaScript) there are interpreters for many popular scripting languages available and as far as I read, all of...

Is there a cross-platform Java method to remove filename special chars?

I'm making a cross-platform application that renames files based on data retrieved online. I'd like to sanitize the Strings I took from a web API for the current platform. I know that different platforms have different file-name requirements, so I was wondering if there's a cross-platform way to do this? Edit: On Windows platforms you ...

SWFUpload and Java: Session is lost.

I am using SWFUpload to upload files to java servlet (spring framework). The problem is that the current web session is lost during file upload (it creates a new session). I read that it is a known bug and there are some workarounds somewhere but I can't find anything. Does anyone know how to make it work? Thanks. ...

How to keep a single column from being reordered in a JTable?

I have a JTable and I need to be able to reorder the columns. However I want the first column to not be able to be re-ordered. I used the following to enable reordering: table.getTableHeader().setReorderingAllowed(true); The columns can now be reordered including the first column which I don't want. Is there any way to lock the first ...

Java video capture on Mac OS X (USB/Firewire)

Looking for resources and information regarding capturing video from an external webcam on Mac OS X using Java. QTKit seems to only offer this functionality in native code. Any information would be appreciated. ...

Book: Modern day equivalent of the Wrox Spring book

I loved the 2005 book "Professional Java Development with the Spring Framework" by Johnson. What would be the 2008-9 equivalent of this in terms of the quality and clarity the book provided? Essentially looking for a book for someone new to Spring, I still think the 2005 book is somewhat relevant, but much has changed in the Spring wor...

Java String contain function?

from the following strings: "details.php?news=13&action=main&menu_type=&option=single&news_id=4792&pub_no=50" Is this possible in String str.contains(strcase) where strcase="details.php", "news_id" can both be checked at the same time. Not like: str.contains("details.php")&&str.contains("news_id"). both cases should be taken to t...

final public static ints can't be used in a switch statement?!

I'm confused. The following code has errors ("..." represents elided code): int byteOrder = ...; switch (byteOrder) { case HDF5Constants.H5T_ORDER_BE: return ByteOrder.BIG_ENDIAN; ... } The error is on the case statement and Eclipse complains "case expressions must be constant expressions". I looked in the source file ...

How create HttpSession using old JSESSIONID?

How can I recreate HttpSession (with cookie, on servlet filters) using JSESSIONID from still active session, passed in request? Thanks for help. ...

Multiple Projects with Eclipse

I have workspace inside of Eclipse which has 2 projects in it. I want to reference project #2 from project #1, but when I go to Project -> Properties -> References, and tick the project that I want to add as a reference, I am still not able to instantiate the classes from project #2 inside of project #1. This is a blackberry app, devel...

How do I get Netbeans to default to Hex display for watch variables?

In Netbeans 6.5 I am debugging a network stream and need to view the memory in Hex. The only way I have found to do this is to right click on each row and select display as Hex. This is very inefficient and I would like either a memory dump or default to hex. Is there a way to do this? ...