java

How can I use a dynamic proxy on constructors that take arguments?

I've tried to use the code Sun posted on their Proxy usage page, and I tried to use the DebugProxy to print which method is invoked. The thing is, the object I'm creating a proxy for, needs to have an argument. If I try to create the proxy with an argument to the constructor, I receive the following error : Exception in thread "main" j...

Difference between thread user time and thread cpu time in Java

The ThreadMXBean has two methods for retrieving thread time usage: getThreadUserTime getThreadCpuTime What is the difference between the two? Update 2: If I'm able to link to the javadocs, please don't quote them - I've read them already. Update: here's some code which I tried to use to learn what these times mean, with little su...

Console based progress in Java

Is there are easy way to implement a rolling percentage for a process in Java, to be displayed in the console? I have a percentage data type (double) I generated during a particular process, but can I force it to the console window and have it refresh, instead of just printing a new line for each new update to the percentage? I was think...

Java gotoxy(x,y) for console applications

I'm writing a simple console application (80x24) in Java, is there a gotoxy(x,y) equivalent? ...

XOM v/s javax.xml.parsers

i want to do read simple XML file .i found http://stackoverflow.com/questions/528664/simple-way-to-do-xml-in-java There are also several parsers available just wanted to make sure that what are the advantages of using XOM parser over suns parser Any suggestions? ...

Sax invalid XML character exception

Hey all, I have downloaded the xml dump of the Stack Over Flow site. While transferring the dump into a mysql database I keep running into the following error: Got an Exception: Character reference "some character set like &#x10" is an invalid XML character. I used UltraEdit (it is a 800 meg file) to remove some characters from the ...

how to get default printer port number in java

i want to access default printer port in java. also, i want to know that is default printer inkjet, laser, dotmetrix etc. please provide me with reference. Thanks. Muhammad Babar Nazir Software Engineer ...

How to write a UTF-8 file with Java?

Hi there, I have some current code and the problem is its creating a 1252 codepage file, i want to force it to create a UTF-8 file Can anyone help me with this code, as i say it currently works... but i need to force the save on utf.. can i pass a parameter or something?? this is what i have, any help really appreciated var out = new...

Warning: modified in the future.

I am getting the warning Warning: sendmailpm.jsp modified in the future. What does this mean? ...

Missing javax.servlet.http.Cookie class

I haven't been using Java extensively hence forget a lot fundamental things. Basically, I am working with a web-dynamic project (using Eclipse IDE with jdk 1.6), and during the build, I get errors that Cookie class and other web related classes cannot be found. What am I missing? What Jars files do I need to add (and how)? thanks ...

How to create war files

What are the best practices of creating war files (using eclipse) to run on tomcat? tutorials, links, examples are highly appreciated. ...

Java bytebuffer to C

Hello, From a C program on Windows we need to read and write like a Java bytebuffer which stores binary in BIG_ENDIAN The algorithm is described at : http://mindprod.com/jgloss/binaryformats.html Need to read and write int and float. Does anyone have example c or C++ code that does this or a reference ? TIA, Bert ...

Applet 1.6 on Mac OS X

I have an applet that I am attempting to test in the 64-bit 1.6 Java VM on Mac OS X. However, Safari is continuing to load the 1.5 VM. I have tried changing the default applet VM to 1.6 in the Java Preferences with no effect. Is there a way to use the new 1.6.0_13 applet VM in Safari (or other browsers) on the Mac at the moment? ...

Managing DLL dependencies with Maven

I have a Java program with Maven managing its dependencies. One of those dependency is a JNI wrapper for another program. Maven takes care of the reference to the relevant JAR file, but I'm left messing around with the DLL file myself. Is there a good way of having Maven handle the DLL as well? Ideally I would like to have the DLL load...

Viewing the contents of Session, Application and Request Bean

It would make a lot of sense to be able to monitor the contents of Session, Application and Request Bean while developing a JSF app but as far as I know, I should explicitly add watch points for the parameters I'm interested in. Is there an easier way to see these values as I navigate through my apps the pages? ...

XStream fromXML() exception

I am trying to deserialize a string in Java using the XStream package. The XStream package can serialize my class fine. I get the XML (cannot change format of XML) from a server and try to save its node information to the corresponding variables in a certain class. My function is at the bottom and I tried to register a new converter for ...

Java System Environment Variable Current User

What is the best way to get the current logged in user through Java application running on JBoss. The system environment variable System.getProperty("user.name") does not work as JBoss is running as a service. The application is running on a laptop running Windows XP. The application is web-based and accessed using Internet Explorer by ...

Changing a constructor param type breaks class in another jar

I have the following class in a common jar: public class Common { public Common(List list) { ... } } I then change the constructor parameter from a List to a Collection as follows: public class Common { public Common(Collection collection) { ... } } Rebuilding the common jar and running the system causes a...

[SWT] Modifier Key state

Hi all, I have a tiny (rikiki) problem in SWT ... I am making a small class extending org.eclipse.swt.widgets.Composite and which is supposed to be nested in an RCP app ... In this small class I have widgets which are supposed to react to mouse or keyboard event BUT I need to use modifier keys (Shift/Ctrl/Alt/...) to alter my copone...

How should I use Enums in Openjpa entities?

I'm trying to use an enum field in an openjpa entiy. Everything works fine unitl I try to enhance my entities which breaks with a ClassNotFound exception for the Enum type. I'm using the openjpa maven plugin to enhance the entities and the enum is declared public and is on the classpath. I'm not sure what I'm missing here. ...