java

Risks associated with changing from default package in Java?

I have an existing code base that is not packaged at all. The code base is all minor Java programs designed to extend/enhance the functionality of a third party program. The current process is one jar per class, one class per file, no package. I'd like to break out the code-base so each jar file is also a package; this eases my jar pro...

Import custom Java classes into Server side javascript in Xpages (Lotus Domino 8.5+)

Hi, With Lotus Domino 8.5.1, one can use "standard" Java classes into server side Javascript (embedded into an Xpage), or Java classes available in the WEB-INF/lib folder. For example : var driverClass:java.lang.Class; var driver:java.sql.Driver; var connection:java.sql.Connection; var statement:java.sql.Statement; driverClass = java....

Java Web Start (JNLP) Loading Message

Is it possible to display a custom loading message when a user loads a java web start application from a webpage? Maybe a progressbar or something similar. Users with slow connections see "Java Loading..." for far too long while the jars are downloaded for the first time. ...

Hibernate on Oracle: mapping String property to CLOB column

WARNING: see my own answer below. The problem is caused by old Oracle drivers that were present on the classpath in addition to 10.2.0.4. Problem solved. Leaving the rest of this question for posterity. I've been banging my head against the following. Here's a simple POJO distilled from my application code: @Entity @Table(name = "PIGGI...

Problem writing to file

I'm having a problem writing to a file: FileInputStream fin; try { fin = new FileInputStream ("c:/text.txt"); PrintStream p = new PrintStream(fin); p.println ("test"); fin.close(); } catch (IOException ioe) { System.err.println (ioe.getMessage); } Is there a problem with this code...

Java String parsing - {k1=v1,k2=v2,...}

I have the following string which will probably contain ~100 entries: String foo = "{k1=v1,k2=v2,...}" and am looking to write the following function: String getValue(String key){ // return the value associated with this key } I would like to do this without using any parsing library. Any ideas for something speedy? ...

Why does this code throw an IndexOfOutBoundsException - aka, what's up with ensureCapacity()?

Consider the following two snippets of code: int index = 676; List<String> strings = new ArrayList<String>(); strings.add(index, "foo"); and int index = 676; List<String> strings = new ArrayList<String>(); strings.ensureCapacity(index); strings.add(index, "foo"); In the first case, I'm not surprised to see an IndexOfOutBoundsExcept...

How to cast DefaultListModel into List<Object>?

I have to put all elements from a DefaultListModel (in a listbox) into a List<Object>. How can I do that in Java? ...

Is it possible to call in some way an EJB deployed on JBoss from a Business Service deployed on BEA AquaLogic Service Bus?

Is it possible to call in some way an EJB deployed on JBoss from a Business Service deployed on BEA AquaLogic Service Bus? Just to precise, I'm not going to call it through Web Service, but through normal EJB call. I would appreciate if anyone has a succesful experience in this matter. ...

Simple if statement in Java

How do i write an if statement in Java that displays Goodbye! if the variable word contains a letter d? Thanks to everyone. ...

View Errors in Intellij Project

I'm new to Intellij (version 8), I've been using Eclipse. How can I view the warnings or errors for my entire project? ...

Recommendation for JDBC SQL client tool

Can someone recommend a good, open source, standalone developer tool for querying SQL databases using JDBC and exporting the results to a file? I know a lot of database vendors provide their own tools, but I need one that will allow me to plug in my own custom JDBC driver and work against any database. A GUI is preferable, but not requir...

Hibernate CollectionOfElements doesn't auto create table in SQL server

Hi, Using auto update (hibernate.hbm2ddl.auto=update) I have a entity which is supppose to create two tables: myentity and myentityconfigurationProperties. This works fine in Mysql 5, but in SQL server 2005 it doesnt create the property table. Anyone knows anything about this? I havn't tried creating the table myself, I'd like to avoid ...

Session Clustering a Grails app in Tomcat

Has any one done it yet? I am having class loader problems de-serializing the grails session object. Here is the error: WARN net.spy.memcached.transcoders.SerializingTranscoder: Caught CNFE decoding 1168 bytes of data [exec] java.lang.ClassNotFoundException: com.myapp.User [exec] at org.codehaus.groovy.tools.RootLoad...

Why doesn't Java have a file copy?

Why does Java not have a file copy method? This seems like such an obvious thing to have, and it saves people from writing things like this example. ...

Suggested Approaches to programmatically make and record a VOIP call

I want to write a program that will be able to call into my company's bi-weekly conference calls, and record the call, so it can then be made into a podcast. I am thinking of using Gizmo's SIP interface (and the fact that it allows you to make toll-free calls for free), but I am having trouble finding any example code (preferably in Jav...

Why can an identifier not start with a number?

Why in java (I dont know any other programming languages) can an identifier not start with a number and why are the following declarations also not allowed? int :b; int -d; int e#; int .f; int 7g; ...

Keystroke not catching LEFT/RIGHT but able to catch UP/DOWN and all other keys.

Hi, I'm binding keys to events in my Java app, however, I have encountered a really strange bug that I hope you guys can help me solve. KeyStroke up = KeyStroke.getKeyStroke("W"); KeyStroke down = KeyStroke.getKeyStroke("S"); KeyStroke right = KeyStroke.getKeyStroke("D"); KeyStroke left = KeyStroke.getKeyStroke("...

Best approach for creating new RPC/web services in the Java world?

I think this question may end up being a bit subjective so I'm marking it as CW. My team is interested in developing a new set of "web services" for our projects to use. I put "web services" in air-quotes since the term can mean so many different things. The only thing we really need it to mean is that we can expose some set of APIs to ...

com.sun.net.httpserver.HttpServer max connection count?

Sometimes (pretty rarely) when I connect to a running instance of a com.sun.net.httpserver.HttpServer I get a "connection refused" message back. Anybody know why this might be? Is there a thread limit to the number of connections it can handle? Can I increase it? Thanks. -r ...