java

No @XmlRootElement generated by JAXB

I'm trying to generate Java classes from the FpML (Finanial Products Markup Language) version 4.5. A ton of code is generated, but I cannot use it. Trying to serialize a simple document I get this: javax.xml.bind.MarshalException - with linked exception: [com.sun.istack.SAXException2: unable to marshal type "org.fpml._2008.fpm...

display of wrong time

I have written a method using JSF: public static String getCurrentTime(Locale locale) { Calendar cal=Calendar.getInstance(locale); return new SimpleDateFormat("HHmmss").format(cal.getTime()); } While testing my application in my local machine I am getting the time same as system time but when my friends are testing...

What is the best way/template to set up connection mysql and jdbc?

What is the best way to set up connection with mysql's jdbc? And execute simple statement. How to do that? Thank you. ...

Java task runtime

Hi! First of all I have to admit that these are very basic and primitive questions... I want to demonstrate different Algorithms in Java for sorting and searching, and to get a value for the runtime. There're issues I cannot solve: there's Hotspot compiling - which is a runtime optimization I need to deactivate (I guess). How do I ge...

Which IDE does Google use for C++ and Java development

I am curious which IDE does Google use for C++ and Java development? ...

Using Property Type Info Hibernate NamingStrategy

I am writing a Hibernate NamingStrategy for our schema. Our legacy schema (for some reason!) includes type information in column names. For example: strproperty intcustomer I am implementing the following method from the NamingStrategy interface: public String propertyToColumnName(String propertyName) I would like to know the Java...

How can I obfuscate a JPF-Project?

Hi, has anyone experience with obfuscating an JPF-Project ("Java Plugin Framework")? I wonder if it is possible to obfuscate the plugins of such a project and what steps are necessary to do this. Especially what changes to the plugin.xml are necessary? Thanks in advance. ...

How to split a comma separated String while ignoring escaped commas?

I need to write a extended version of the StringUtils.commaDelimitedListToStringArray function which gets an additional parameter: the escape char. so calling my: commaDelimitedListToStringArray("test,test\\,test\\,test,test", "\\") should return: ["test", "test,test,test", "test"] My current attempt is to use String.split() to s...

Java export .properties file to build folder?

Hello. I have just created a .properties file in Java and got it to work. The problem is where/how to store it. I'm currently developing a "Dynamic Web project" in Eclipse, and have stored the properties file under build/classes/myfile.properties, and I'm using this code to load it: properties.load(this.getClass().getResourceAsStream("/...

Obfuscating Jar files with other Jar files embedded

So figure we have a Jar file with our Java application, and it has inside of it the Jar files for the libraries it depends of, a the jdbc or any other third party jar. How do you proceed to obfuscate it with free software? I mean, obfuscate your code and leave the Jars untouched. I tried with Proguard, to no avail. Even the author told...

OpenGL - Unable to render colors other than white after texture mapping.

Hi, I'm trying to render a colored cube after rendering other cubes that have textures. I have multiple "Drawer" objects that conform to the Drawer interface, and I pass each a reference to the GL object to the draw( final GL gl ) method of each individual implementing class. However, no matter what I do, I seem unable to render a color...

Wrong Encoding in JAX-WS Dispatch Response

I'm trying to access a web service with JAX-WS using: Dispatch<Source> sourceDispatch = null; sourceDispatch = service.createDispatch(portQName, Source.class, Service.Mode.PAYLOAD); Source result = sourceDispatch.invoke(new StreamSource(new StringReader(req))); System.out.println(sourceToXMLString(result)); where: private static Str...

Access non-public classes in sun.awt package [specifically: FetcherInfo]

Question: I have some performance problem in my app - and the bottleneck is sun.awt.image.ImageFetcher.run, and I canno't get any (more) meaningfull info from profiler. So I figured that it would be nice to look at jobs that ImageFetcher is doing. I couldn't get access to FetcherInfo class, that holds all ImageFetcher jobs. To obtain ...

Is it possible to have specialized parameters in overridden methods?

Let's say I have an abstract parent class called "shape", and that there are multiple subclasses (triangle, square, circle... ). I want to define an abstract method in the parent "shape" class which all subclasses must implement, let's call it "draw". So all shape subclasses must provide the "draw()" method. But, the draw method takes a ...

How do I prompt the user to install JRE if she hasn't it already?

I am writing a Java applet, and would like to know the best way to include it in a web page. I'd like it to prompt the user to install JRE if she hasn't it already. This feature should (ideally) work cross-browser on any OS Java runs on. Another requirement is that the applet should not be loaded on page load, but after a user action, n...

Java Applet to manage file uploads to server

Looking for a descent looking Java File Upload Applet (or even Flash) that fits the following requirements: Free/cheap (yes looking to use in a commercial web application) Preferably allow multiple file selection Ability to create/edit folders on destination server? (within a secure root folder) Ability to overwrite files in the destin...

Java desktop app: How to maximize tray application when hotkey pressed?

I need to write a program that, when minimized, lives in the System Tray, and I'll use Java 6's SystemTray API to do that. How can I make that application comes to the foreground when the user presses some hotkey? For example, the app is running but minimized. When the user presses CTRL-SHIFT-Y or something (or, like Google Desktop's ...

Jsp download file size.

We are running tomcat, and we are generating pdf files on the fly. I do not have the file size before hand, so I cannot direcly link to a file on the server. So I directly send the output. response.setContentType("application/force-download"); OutputStream o = response.getOutputStream(); And then I directly output to this OutputStre...

Create AppleDouble formatted file in Linux

Hello, I'm working on an application that syncs data. For Mac OS, files are uploaded and if they contain resource fork information, the fork is read and stored as a string using: file/..namedfork/rsrc Users can access their files using a Web application(Java) that's running on a Linux server, is there a way that I can generate a valid...

Using single RMI Registry

Hi I've been using RMI for a project I am currently working on and I want to bind from multiple hosts to a single RMI registry. However when I attempt to do so I get an error saying java.rmi.AccessException: Registry.Registry.bind disallowed; origin / 192.168.0.9 is non-local host I did so googling and it seems that RMI stops remote...