java

java connection to jabber

What type of stream I need to use to write a connect request message over a tcp socket, to jabber. I'mwriting a string with xml format. It should worked with the default socket stream or a dataoutputstream but it doesn't. ...

which library better for faster java application swt or swing?

which library better for faster java application swt or swing? ...

How can I access a public static member of a Java class from Coldfusion?

I think the above question says it all. ...

What is a component

I listen to the podcast java posse, on this there is often discussion about components (note components are not (clearly) objects). They lament the fact that Java does not have components, and contrast with .NET that does. Components apparently makes developing applications (not just GUI apps) easier. I can figure from the discussion...

How can I find out what enums are defined by a class?

I know I can get the public static members of a class by doing something like: obj.getClass().getFields() but this doesn't get me the enums. I'd like to be able to get them from the Class object returned by the getClass method. Any ideas? ...

Java version names in Sun's bug database

In http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6525150 it says Release Fixed 7(b14), 6u2(b01) (Bug ID:2147561) What does 6u2 mean? (Am I right in assuming it as 1.6.0_02 ?) ...

Custom ID in session handling by Java Servlet API

Is it possible to assign a custom ID to a HTTP session through Servlet API? I know that session handling from any application server, Tomcat for example, it's enough good to generate unique IDs. But I have custom unique session IDs based on information per user and time, so it won't be repeated. And I looked at every documentation abou...

JSE vs J2EE, college and career

I'm currently studying Computer Science at College where they mainly teach Java standard edition, I see that in the industry this isn't used much, instead J2EE is used. If my College is teaching me JSE rather than J2EE does this make me less employable? And what exaclt are the differences? different syntax? different way of prgramming o...

Cobertura refuses to acknowledge code was covered

I am using the Maven (2) Cobertura plug-in to create reports on code coverage, and I have the following stub I am using in a method: try { System.exit(0); } catch (final SecurityException exception) { exception.printStackTrace(); } System.err.println("The program never exited!"); I know that I need to log the exception, etc, b...

Java webservice (soap) client - use certificates

I am trying to connect to a webservice over ssl with a client certificate. Is there an elegant way of doing this apart from shoving things like "javax.net.ssl.keyStore" into System.properties. Any pointers to code examples would be appreciated. ...

Java: Triple Curly Bracing

I've been given some code with commenting unlike anything I've come across before: //{{{ Imports import imports; //}}} It is the same for each method block, //{{{ above the code block //}}} below the code block ALSO SEE: http://en.wikipedia.org/wiki/Folding_editor ...

Printing out items in any Collection in reverse order?

Okay, so I have the following problem in my Data Structures and Problem Solving using Java book: Write a routine that uses the Collections API to print out the items in any Collection in reverse order. Do not use a ListIterator. I'm not putting it up here because I want somebody to do my homework, I just can't seem to understand exact...

How do I reference assets from a different subdomain (or CDN) in production?

I am working both in the Ruby and Java worlds. I have been inspired somewhat by the merb-assets project, which provides various functionality to make it easy to reference assets (images, CSS, etc.) located on a subdomain (or CDN). I want to do the same in Java: in development and testing, I want to use either JSTL's <c:url> or Struts ...

How to get Cobertura to fail M2 build for low code coverage

I'm trying to configure my WAR project build to fail if the line or branch coverage is below given thresholds. I've been using the configuration provided on page 455 of the excellent book Java Power Tools, but with no success. Here's the relevant snippet of my project's Maven 2 POM: <build> ... <plugins> <plugin> <groupId>org.code...

Java file input as command line argument

How do you process information in Java that was input from a file. For Example: suppose you have a file input.txt. The contents of this file is: abcdefghizzzzjklmnop azzbcdefghijklmnop My hope would be that the information would be put into the argument array of strings such that the following code would output "abcdefghizzzzjklmnop...

What is the easiest/best/most correct way to iterate through the characters of a string in Java?

StringTokenizer? Convert the String to a char[] and iterate over that? Something else? ...

Searching for a safe way to do authentication from a mobile app

I've inherited a mobile app which sends auth credentials (userid/password) in the clear. I'd imagine that I have 2 choices: a) use TLS. b) write my own auth protocol. If I choose (b) what are the key guidelines that I must follow to make it it secure. e.g. how to avoid replay attacks, encryption strategies. Thanks ...

Java2D Performance Issues

I'm having performance oddities with Java2D. I know of the sun.java2d.opengl VM parameter to enable 3D acceleration for 2D, but even using that has some weird issues. Here are results of tests I ran: Drawing a 25x18 map with 32x32 pixel tiles on a JComponent Image 1 = .bmp format, Image 2 = A .png format Without -Dsun.java2d.opengl=t...

Can anyone recommend a Java rich text editor?

The rich text editor must be implemented in Java, provide Swing support, and preferably be open source. I'm looking to integrate it into an existing Java/Swing application. Thanks. ...

javac.exe AST programmatic access example

Is it possible to access the Abstract Syntax Tree(AST) inside the javac.exe programmatically? Could you provide an example? ...