java

In Java, what's the fastest way to "build" and use a string, character by character?

I have a Java socket connection that is receiving data intermittently. The number of bytes of data received with each burst varies. The data may or may not be terminated by a well-known character (such as CR or LF). The length of each burst of data is variable. I'm attempting to build a string out of each burst of data. What is the fast...

Log4j SMTPAppender

Hi everyone, I have some problems trying to play with SMTPAppender. Here is my property file concerning the SMTPAppender : #Email config log4j.appender.mail=org.apache.log4j.net.SMTPAppender #defines how often emails are send log4j.appender.mail.BufferSize=1 log4j.appender.mail.SMTPHost=smtp.me.com log4j.appender.mail.SMTPUsername=use...

Java Mac OS X running with out a Dock Icon

i have a swing application that i would like to run on os x without a dock icon. Just a system tray icon. I know about headless but if i set that property i can not create JFrames. Is it possible to run a swing application without a dock icon in java? or through JNA if there is a native way. ...

Cannot access resources defined in EAR from the outside classes (JBoss 5.1)

I have a resource file located in WAR file stored inside of EAR. The location is, to be precise: myApp-web.ear/myApp.war/WEB-INF/classes/file.properties. I'm trying to access this file from another class located in JAR file (not within the main EAR). This is how I'm trying to access the file: SomeClass.class.getResourceAsStream("/WEB...

ClassNotFoundException for class file on classpath

Hello all! I have the following code: // Test TODO remove try { System.out.println(System.getProperties().getProperty("java.class.path")); this.getClass().getClassLoader().loadClass("mypackage.MyClass"); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } Now the output shows me,...

Objects in Java Reference or Value

Hi, just for my understanding. Does my example code below actually changes the the color of my Car Object in the IntHashtable or does the first line creates another instance of the car object, which contains color = red after the second line? thanks, Henrik Car myCar = (Car)myIntHashTable.get(index); myCar.setColor = red; Edit: Is...

how to know speed of processor fan ?

i want to detect processors fan speed is there any Java library to do so. ...

Terminating a specific thread from a Multi-Threading program in Java

Am working on a program in Java as shown below, the class is simply executing commands into the operating system level. Yet, sometimes we are facing a problem where the program get stuck, so the command never return any status, thus the thread does not terminate. Now am trying to enhance the code, add an additional thing where I can kil...

pubsub publish to node success, retrieve from node fail

Below showed i suggest published to node call "ghost2" iq id="kB8dk-0" to="computer/2c10ee6b" type="result"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><jid>admin@computer/Smack</jid></bind></iq> <iq id="kB8dk-1" to="admin@computer/Smack" type="result"></iq> <iq id="kB8dk-2" to="admin@computer/Smack" type="result"><query xmlns="jabbe...

No Stack Information - V(Unknown Source)

I am having a problem with my app, and wondering why I am not getting any stack information just; java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at com.x.y.z.()V(Unknown Source) I am building using an Ant script - do I need to fiddle with some sort of compilation verbosity setting? P.S. I am no...

unboxing using the ASM Java library

I'm using the ASM Java library to replace some reflection. I generate the body of this method: void set(Object object, int fieldIndex, Object value); With this generated method, I can set fields on an object at runtime without using reflection. It works great. However, I found it fails for primitive fields. Here is the relevant part o...

Mixing JSF and Trinidad tags

Hi all, recently I got the Trinidad library going in a JSF based application of mine. (cmp this SO-question) Now I want to include some user interaction, making use of the dialog API. I worked alongside the fairly detailed DevGuide provided with the API, but I'm stuck at the followong point: TrinidadTags work in my JSF-xhtml Pages add...

Can the Spring Framework be used for batch applications?

My company is switching to Spring for our Java framework, and from what I understand it will work well for that, but we also have many Java batch applications*. Does Spring have adequate support for running batch applications? What features of spring will be useful in this environment, and won't work at all? * Java command line progra...

readXmlfile from java

Hello I've written small class in java to read in xml file as a string, not my question is following : how do I append string so it outputs only what is between Physical_Order_List_Array tags here is a java class : public static String getFileContent(String fileName) { BufferedReader br = null; StringBuilder sb = new Stri...

Handling huge numbers C, Java, Informix

Hi all, We are in a situation to handle numbers with a maximum of 15 digits. We need to parse this value from a text file, through C, store it in Informix table. There is another Java component that reads these values, does mathematical operations and computes a result. I have been doing some research on this and found that the int8 da...

How to make a JFrame have no taskbar button ?

I would like to have a normal JFrame with its full functionalities (decoration, title, icon, resizing, minimizing, maximizing, etc.), with the only thing that it wouldn't appear in the system's taskbar. (Typically, there would be another program opening and managing them). Is it possible ? And if yes, what is the best way to do that ? ...

Javassist Enhancement failed

I use Jboss IDE as IDE. I have created a Hibernate project. and I get this error when deploying my .har (Hibernate project) : 16:16:30,910 ERROR [BasicLazyInitializer] Javassist Enhancement failed: com.afrikbrain.iard.srv.ref.AssGarantieProduit java.lang.NullPointerException at org.jboss.mx.loading.RepositoryClassLoader.findClass(Repos...

SQL Server Express 2005 Ambiguous column name problem

I am using SQL Server 2005 Express. While I am executed the query I am getting wrong values select City, City2 from sample.dbo.NameAddress where FirstName like 'rama%' and LastName like 'suresh%' Getting same values for the both columns but actually they are different in DB, When I see entire table ...

Java "\u0001something" doesn't return expected results

I'm trying to put together a string that starts with the ascii "Start of Header" character (0x01). I did this on my home computer simple enough with: String out = "\u0001this"; System.out.println(out); prints a square to the terminal.. Copy and paste to hex editor and I have my 0x01; Now at work.. I do the same thing but anything bel...

Creating an executable jar file from a clojure project?

I have a clojure project that uses the slick 2d game engine that I am trying to run as an executable jar file. I created the project in both Netbeans and Eclipse and I have had no luck exporting them into an executable format. It keeps giving the error could not find the main class, followed by giving my main class. I have tried editing ...