java

class not found exception in hibernate

i am geting the following errot when i am tryinh to run my j2ee projrct. the same project was working before and i started geting this exception now. i am sure that all class are there along with their mapping files if i remove mappping of jobtitle from my hibernate.cfg.xml ien the project is running java.lang.ExceptionInInitializerErr...

how to check the jdk version used to compile a .class file

I'm trying to debug a "Bad version number in .class file' error in java, is there a way for me to check which version the .class files are? I'm using Jre1.5.0_6, but my JDK is version 1.6.0_13, I'm compiling with compatibility mode set to 1.5 in eclipse which I thought would work... ...

Is Scala/Java not respecting w3 "excess dtd traffic" specs?

I'm new to Scala, so I may be off base on this, I want to know if the problem is my code. Given the Scala file httpparse, simplified to: object Http { import java.io.InputStream; import java.net.URL; def request(urlString:String): (Boolean, InputStream) = try { val url = new URL(urlString) val body = ur...

I need to upload Open Flash Chart 2 image to servlet

How can I upload image with JavaScript from Open Flash Chart 2 to servlet? What I have to implement so that I can save that image to my server ? ...

Validate an XML file against local DTD file with Java

How can I validate an XML file against a DTD that is stored locally as a file? The XML file does not have any DOCTYPE declaration (or may have one that should then be overridden). I had a look at this thread but besides the fact they are using .NET I doubt that this is a good solution. Any input appreciated! ...

RandomAccessFile.write not writing what I tell it to

Hey all. I'm reading from one sql-format file to another, and two bytes in the middle are being corrupted, and I assume it's some preparation or safeguard that I didn't do. Example of corrupted data: //From the file that is read from. added ** to emphasize the corrupted byte insert into viruses (virusSig,virusHash) values ( X'579fdc56...

Add image to JAR Java

Hi, I'm using some imgages in JFrame, I have given a path to load image into panel of the frame, but when i made jar of the application its not dispalying images. Where should I place the image? How should I specify the path? setIconImage(Toolkit.getDefaultToolkit().getImage( "D:\RFT\src\dailogBox\dump.jpg")); like this i have do...

Is there a sophisticated file system monitor for Java which is freeware or open source?

I'm looking for a Java library which can notify me about changes on the file system. I found some free libraries, but they all use brute-force detection, i.e. polling in regular intervals. And the other ones are always commercial. What I'm looking for is a library which uses the file monitor functions from the OS, i.e. FindFirstChange...

Custom tasks in Ant: addTYPE(TYPE x) vs add(TYPE x) (latter doesn't work)

I'm writing a custom Ant task that needs to accept a custom nested type. According to the Ant manual, I should be able to use addConfigured(TYPE x) rather than addConfiguredTYPE(TYPE x). Also, according to this article (section New Reflection rules, Polymorphism in Ant 1.6) support for addConfigured(TYPE x) was added in Ant 1.6. <taskd...

Automatic Java to C++ conversion

Has anyone tried automatic Java to C++ conversion for speed improvements? Is it a maintenance nightmare in the long run? Just read that is used to generate the HTML5 parsing engine in Gecko http://ejohn.org/blog/html-5-parsing/ ...

How to read a string line per line

Given a string that isn't too long, what is the best way to read it line by line? I know you can do: BufferedReader reader = new BufferedReader(new StringReader(<string>)); reader.readLine(); Another way would be to take the substring on the eol: final String eol = System.getProperty("line.separator"); output = output.substring(outp...

Quaere - Anyone using it yet? (LINQ to Objects for Java)

Hi there I'm a .NET guy originally, working in Java recently, and finding I'm really missing LINQ to Objects, specifically for performing filtering against collections. A few people here on Stack Overflow have answered the "LINQ for Java?" question with a single word : Quaere However, on the site it clearly states "Pre-Beta", an...

Setting character encoding with request parameter

Is it possible to pass a request param containing the encoding to a filter which checks if there is a value and sets it as character encoding? I have read that calling the method to setting the character encoding should be done before reading the request params. Is there maybe another way to do this? Edit: Java / Java Server Pages ...

Java 1.6 Applet and Mac OS X, is there an official issue here?

I'm developing an applet in Java 1.6 which is supposed (ofcourse) to run on Mac and PC. However people with Mac seems to all have Java 1.5 installed even due they keep thier software updated with the Mac update tool. This seems very strange to me that Java isn't automatically updated by Apple as Java 1.6 was released in 2006. Is there...

Learning java as a C++ programmer

Long story short: I'm looking for either a book or documentation/reference explaining basic java syntax and functionality from a C++ perspective. I don't need to know about design patterns, encapsulation, keywords such as 'static', etc. What I do want is to know what packages are, know about the import/extends keywords, mostly syntax r...

List<Byte> to String, can you help refactor this ( small ) method ?

Hello, We use this small utility method. But we dont like it. Since it's not very crucial ( that work anyway ... ) , we have forget it. But that's ugly, because we have to go through the whole array, only to convert it from Byte[] to byte[]. I'm looking for a way to cast the Byte [] in byte [] without go throu it or for a utility m...

Java: Implementing a Unsigned 128bit Integer

** first off I should ask: ** Does anyone knows of a current implementation 126b UINT for Java ? I need something to hold natural cardinal values. ie: A huge counter. I know of BigIntegers, which are slow and immutable. A 128b UINT makes sense ... I was think about implementing an OWORD, using a pair of primitive longs. Overflows wou...

best book to learn J2EE

I have a friend who asked me about a good book to learn J2EE as a beginner. and I thought I would ask other more knowledgeaable people. what book/resources do you recommend for learning J2EEe as a beginner ? ...

Performance impact of Java class files generated with "-target 1.5" running on a 1.6 VM?

After migrating my whole setup from Java 1.5 to 1.6 (J2EE, Tomcat) a couple of months ago, I just realized that Maven is still configured to generate class files targeted for 1.5 via Sun's javac parameter "-target 1.5". Can I expect any performance boosts when changing "-target 1.5" to "-target 1.6"? ...

completionservice: how to kill all threads and return result through 5 seconds?

Hello. I have some problem with CompletionService. My task: to parse parallely for about 300 html pages, i need to wait for all the results only for 5 seconds, then - return the result to main code. I`ve decided to use CompletionService + Callable for this. The question is how to stop all threads, that were caused by CompletionService a...