java

why does hibernate not force you to mark fields as virtual, but nhibernate does?

why does hibernate not force you to mark fields as virtual, but nhibernate does? Is this a result of the differences between the VM and CLR? ...

Authentication fails in HttpClient but OK in browser

I'm using HttpClient 4.0 to get some XML from the remote host. When I use URL such as https://user:[email protected] it works fine in the browser but fails in the HttpClient with this stacktrace (follows). Any suggestions? I'm using SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER while setting ThreadSafeClientConnManager to handle HTTPS ...

Google Calendar API Sharing Example

Hi Experts, I am looking for examples of share calendar and share event using google calendar API in any programming language java, .net, java script. Thanks, Aqeel ...

Dynamically adding toolbars in Java Swing GUI

I am developing a Java Desktop Application. In the GUI, I want that user can add as many toolbars dynamically as he wants. To implement this, the following are the things that I have done already: Have taken a mainPanel and set its layout as BorderLayout Then taken a topPanel and added it to the mainPanel's BorderLayout.NORTH set the t...

NoClassDefFoundError in spring

Hello, I wrote a Spring application which runs on Weblogic 10.3. In this application I have some JMS Queue consumers. Sometimes I got an error when the application is closing or opening (I saw this error in both situation) saying: java.lang.NoClassDefFoundError: org/springframework/jms/connection/SmartConnectionFactory at...

Synth LaF JLabel DISABLED color

Hi all, Using the Synth LaF, I am unable to set a JLabel's FOREGROUND color for the DISABLED state. has anybody succeeded in doing this? Here is my label's style definition in my LaF.xml file. <style id="whiteLabelStyle"> <opaque value="false"/> <font name="Bitstream Vera Sans" size="16" /> <state> ...

reading/writing to files so it works in both a linux/windows environment

If someone installs my java application on their computer (windows/linux/mac), how can I make sure my applications ability to read/write files works in all environments. Is there a way for my application to figure out where in the file system it is installed, and then read/write safely? Note: these files that are being read/written a...

Renaming a file in Java without using renameTo()

Disregarding my last post, I've found the source of the problem. I'm using a.renameTo(b) when b doesn't exist. The reason it doesn't exist is because there is a symbolic link so if b is "/usr/name/folder/file", then b really is "/mnt/MountTest" because the symlink is to that directory. So the question is, is there an alternative way...

Are there any goodies for SCJP?

Hi All, Just want to know whether SUN is providing any goodies (either free or paid), which can be availed for SCJPs ?? I heard like Microsoft is providing such goodies. Anybody has any idea on this? Cheers, PK ...

Connection problem in Win2k3 server 64 bit with JDBC

DriverManager#getConnection() returns null when I am deploying my JSP/Servlet package in a Windows 2003 Server environment (64 bit). The database is Microsoft SQL 2005 Enterprise Edition. The code is: Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con = DriverManager.getConnection("jdbc:odbc:calsoft2k","xxx","xxx"); The same code is ...

Can I switch user on runnable thread in Java ?

Suppose I need to run this on shell, $ su <user>; cp /x /y; Is there a way to run threads with another unix user within the application ? ...

syntax difference between generics in java and c#

I'm coming from a c# background, how do generics look in java compared to c#? (basic usage) ...

Preemptive Basic authentication with Apache HttpClient 4

Is there an easier way to setup the http client for preemptive basic authentication that what described here? In previous version (3.x) it used to be a simple method call (eg, httpClient.getParams().setAuthenticationPreemptive(true)). The main thing I want to avoid is adding the BasicHttpContext to each method I execute. ...

C# developers learning Java, what are the biggest differences one may overlook?

For c# developers that are staring out to learn Java, are there any big underlying differences between the two languages that should be pointed out? Maybe some people may assume things to be the same, but there are some import aspects that shouldn't be overlooked? (or you can really screw up!) Maybe in terms of OOP constructs, the way ...

What's the correct way to try a method again after a exception has been handled?

I am new to exceptions, haven't covered them in college yet so still learning about them. I tried this and it seems to work, but doesn't seem "right". What's the correct way to try a method again after a exception has been handled? public static void openCSV(String file) { FileInputStream fis; try { fis = new FileInputS...

Java Swing GUI - Problem

I have created a GUI in Java using swings with the help of Netbeans IDE. Now the problem is when I click on "Preview Design", the look and feel of the GUI is that of my O.S i.e Windows XP but when I click on "Run" button to run the application, then the look and feel of the GUI is metalic. How can I set the tone of the GUI. (It would b...

what is the use of strictfp non- access modifier?

I know this is a duplicate question. but i want know it with an example. so can anyone explain it with an example? Link to duplicate post: http://stackoverflow.com/questions/517915/when-to-use-strictfp-keyword-in-java ...

using load/get using generics

With Hibernate, how do I load an entity using generics? Curretly I am doing: Entity e = (Entity) session.load(Entity.class, 123); In NHibernate, with generics, I can do: session.Get<Entity>(123); What's the Hibernate equivalent? ...

Finding the current persistence unit for the current EntityManagerFactory

I noticed that calling createEntityManagerFactory(null) will use the default Persistence Unit (PU) in the configuration file. Sometimes the classpaths get really messed up at deployment and I'd really like to see the name of the current PU for a given EntityManagerFactory. Is there any way to do this? Also, I would love to go so far a...

Android RSS Example

How do you do you fetch a single RSS feed and show it in an ListView? I realize there's hundreds of ways, but a clean and simple example would be appreciated. ...