java

How to get the EJB listening port?

I'm currently developing a library for monitoring calls to several remote services (WebServices, EJBs...). One of the parameters that i would like to register is the port from which a EJB is called (a Stateless Session Bean invoked like a remote object) There is any standarised way of getting the port? Or should I inspect the JNDI tre...

Java/MSSQL: java.sql.SQLException Invalid object name 'TableName'.

I'm trying to move a java application from an old server to a new server. The application runs on Tomcat, uses Microsoft SQL Server as the backend DB, and used a system DSN defined in Data Sources (ODBC) to decide where to connect to. The old server used Windows 2000/SQL server 2000, the new server uses Windows 2003/SQL Server 2005. T...

How do I connect to an Access database over a LAN using Java?

Do you know of any good guides on how to access an Access database using Java? I know the basics and basic SQL, but I'm thinking more about access control. ...

Java: How to get the unique ID of an object which overrides hashCode()?

Hello! When a class in Java doesn't override hashCode(), printing an instance of this class gives a nice unique number. The Javadoc of Object says about hashCode(): As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. But when the class overrides hash...

In-Memory File System for WIndows

I have a command-line executable which I need to run from Java on Windows XP. It uses files as input and output. But I want to avoid the overhead of file IO, so I thought of an in-memory RAM file system. NetBSD has mount_mfs. Could you recommend the most convenient way of doing this? ...

Can hibernate map EnumTypes with whitespaces?

Having a hibernate mapping a legacy database I want to use EnumTypes to map certain columns that contain string constants with whitespace to some Enum class. The mapping: @Entity @Table(name = "OPERATOR") public class Operator { @Id @Column(name = "ID") private Long id; ... @Enumerated(EnumType.STRING) @Colu...

How to combine two FORs into one

This might be stupid, but I'm want to know if it's possible, lets start with 5x5 a matrix int[][] x = new int[5][5]; Random rg = new Random(); now let's fill it with Pseudo Random information for(int i=0;i<5;i++){ for(int j =0; j<5;j++){ x[i][j] = rg.nextInt(); } } but how can I do this right with one Single ...

java 6 broke webstart application installation with error 'java.lang.Exception: cache failed for'

After upgrading to the latest java version (Java 6 update 13) a webstart application that was being used in production environments for many years, stopped installing with the following error: java.lang.Exception: cache failed forhttp://localhost:8080/ReactorStudio/studio/installer.jnlp at com.sun.javaws.Launcher.updateFinalLaun...

Fixing a swing component's height within a Box layout

Good morning, I am making a GUI thanks to javax.swing.Box class Inside the panel: JLabel JTable with fixed height JLabel JTable with automatic height I tried everything to fix the first JTable height but without any success. I dedicate a Box.createHorizontalBox() for each component of the above rows and then I add them to the Box.cr...

How does db4o instantiate objects ?

What mechanism does db4o use to instatniate stored objects ? My class isn't Serializable and doesn't provide zero argument constructor and the only constructor throws NullPointerException when it's argument is null. In spite of that db4o can still instantiate stored objects of that class (thugh with incorrect values). If I can underst...

Can we have uneditable text in edittext

Hi, I am using an EditText. Is it possible to have a part of text uneditable and the rest editable in the same EditText? Thanks in advance ...

Reflection in Java

How can i access a varible defined inside a method by using reflection? I have to create criteria in hibenate. Database is attribute based database. Let's talk about a movie. A movie can have many language and many genre. e.g. Movieid property value 1 Language Hindi 1 La...

Want to develop Jasper Report with Struts2

Hello All, I am developing project using Spring, Struts2 & Hibernate. Now i want to use a Jasper Report with Struts2. But i am totally new with Jasper Report. Can anyone give simple example or a tutorial or any other link which can help me.. Thanx in advance.. ...

Disable HTML parsing in JComboBox.addItem(o)

I'm looking for a way to disable HTML parsing of the addItem() method in JComboBox(). JComboBox jHighlight = new JComboBox(); for (int i = 0; i < tl.size(); i++) { //getTagname() returns a string like "br", "a", "body" or "html" jHighlight.addItem("<" + tl.get(i).getTagname() + ">"); } The output in the JComboBox will look ...

Oracle Forms 10 / java

Is it possible for a java application, called by Oracle Forms, to participate in the same database session like Forms? ...

Nice way to do this in modern OO C-like language?

I have Tiles which represent the tiles in a game's 2-dimensional world. The tiles can have walls on any number of their 4 sides. I have something like this at the moment: interface Tile { boolean isWallAtTop(); boolean isWallAtRight(); boolean isWallAtLeft(); boolean isWallAtBottom(); } Somewhere else I also have 16 ...

Why does Java have transient variables?

Why does Java have transient variables? ...

java logger to one file over several classes and packages

I'm trying to figure out how to use the java.util.logging features. All of the tutorials show how to log to a log file from the main class, but I cannot figure out how I can log to one file in various classes. I have a web service and a web service client and I'd like to be able to log errors on the web service while using the web serv...

How to parse a large HTML file with Java HTMLParser library

I have some html files created by Filemaker export. Each file is basically a huge HTML table. I want to iterate through the table rows and populate them into a database. I have tried to do it with HTMLParser as follows: String inputHTML = readFile("filemakerExport.htm","UTF-8"); Parser parser = new Parser(); parser.setInputHTML(inputHTM...

How to set enviroment variables for ANT build.xml file? (Java)

I am trying to open a project with the Windows version of Eclipse, but after choosing to open the build.xml file the error message says: Problem setting the classpath of the project from the javac classpath: C:\project1\${env.TOMCATEB_HOME} I tried to set TOMCATEB_HOME environment variable in the Windows control panel, pointing...