java

Free XML based java gui language with builder

Is there a free decent java GUI descriptor language (probably XML based), which has a Glade-like (WYSIWYG) GUI builder? ...

Configure GWT in Eclipse

Installed Google App Engine 1.2.5 and Web Toolkit 1.7.1. However I still get a red underline whenever I import gwt and user any of it's classes like graphCanvas. How do I take this underline away? What haven't I configured correctly? ...

Network listener Android

Hi all, I want to check when the network of phone in android goes off can i capture that event .I am not getting the proper API or any example which would explain the same . If any one had done or any example links would be really helpfull Thanks in advance ...

Sending Email Using A Servlet

I have to send an email through a servlet, I have tried a bunch of codes, but none of them work with an gmail account, any ideas? java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); Properties props = new Properties(); props.put("mail.transport.protocol", "smtp"); props.put("mail.smt...

Log4J – Runtime variable substitution

Log4J appears to have an annoying restriction – at runtime, variable substitution does not appear to work. In this example File: Log4j.properties file_pattern=%d{ISO8601} %-5p %m%n log4j.rootLogger=DEBUG, FileAppender log4j.appender.FileAppender=org.apache.log4j.FileAppender log4j.appender.FileAppender.layout=org.apache...

Should heavy-weight java objects be saved in session via setAttribute? Is it a good practice in servlet development?

I mean if I construct a heavy object [including collections and a bunch of props ] and I need to query that object from time to time during the session life, should I save it with setAttribute or do I need to persist it somewhere? What are best practices here? ...

How to round *down* integers in Java?

I'd like to round integers down to their nearest 1000 in Java. So for example: 13,623 rounds to 13,000 18,999 rounds to 18,000 etc ...

Java, Massive message processing with queue manager (trading)

Hello, I would like to design a simple application (without j2ee and jms) that can process massive amount of messages (like in trading systems) I have created a service that can receive messages and place them in a queue to so that the system won't stuck when overloaded. Then I created a service (QueueService) that wraps the queue an...

Spring JTA configuration - how to set TransactionManager?

We configure our Spring transaction in Spring config as: <tx:jta-transaction-manager/> I gather this means that Spring will automatically discover the underlying JTA implementation. So when we start up JBoss we see these messages while Spring searches: [JtaTransactionManager] [ ] No JTA TransactionManager found at fallback JNDI loca...

Auto adjust the height of rows in a JTable

In a JTable, how can I make some rows automatically increase height to show the complete multiline text inside? This is how it is displayed at the moment: I do not want to set the height for all rows, but only for the ones which have multiline text. ...

JNI Invocation API - NoClassDefFoundError (C/Java)

I am trying to get my feet wet with JNI because I have an application in C that needs to access a single Java library function (no C-equivalent library). I've written a very simple test program to load a Java VM from C and call a static function and get the return value. Unfortunately, I am unable to get the class to properly load. Al...

How can one read a text file in a Struts 2 app.

Hi guys. Developing a Struts 2 app I run in a following problem. I need to read a text file that is deployed in web server with my app. How can I access it knowing its relative path. In other words how can I find absolute path if I know relative path inside the deployed directory. When I had similar problem with servlets I used to use t...

Sending an Email Using Commons-Email to Gmail

Email email = new SimpleEmail(); String authuser = "[email protected]"; String authpwd = "*******"; // Very Important, Don't use email.setAuthentication() email.setSmtpPort(465); email.setAuthenticator(new DefaultAuthenticator(authuser, authpwd)); email.setDebug(true); // true if you want to debug email.setHostName("smtp.gmail.com"); ema...

Java: Difference between the setPreferredSize() and setSize() methods in components

Ok, I read the Java Documentation and I just can't figure out what is the main difference between those two methods. Sometimes I used setSize(), sometimes setPreferredSize(), sometimes one does what I want, sometimes the other. So, what is the main difference between the two? Which one should I use for JFrames and JPanels? Thanks ...

java value object

I'm new to Java and I have to create a value object, (maybe it's called mapped object in Java) but my code doesn't seem to work, here is the value object: package ....; public class User { private int id; private int uid; private String name; public User() { // do something here } } and I assi...

Java: How to use BigInteger?

I have this piece of code, which is not working: BigInteger sum = BigInteger.valueOf(0); for(int i = 2; i < 5000; i++) { if (isPrim(i)) { sum.add(BigInteger.valueOf(i)); } } The sum variable is always 0. What am I doing wrong? ...

maven-assembly-plugin for certain files

I have the multi module project this is the parent pom. <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt; <modelVersion>4.0.0</modelVersion>...

add toolbar to section

Hello, I want to add a toolbar to a section in SWT. There is an example i saw in the PDE manifest editor. How can i add this toolbar or buttons? maybe i need to use a different control? Thank you, Ido ...

Intellij Community can't use http proxy for Maven

I have Intellij IDEA Community installed on a Linux box that needs to use an authenticated proxy to get to the Internet. I have a system-wide proxy on the box that works, and I have the proxy configured in ~/.m2/settings.xml. Maven correctly uses the proxy when I run try it from the command-line. I have the same proxy configured with...

How can I convert scala.xml.Elem to something compatible with the javax.xml APIs?

I have a Scala representation of some XML (i.e. a scala.xml.Elem), and I'd like to use it with some of the standard Java XML APIs (specifically SchemaFactory). It looks like converting my Elem to a javax.xml.transform.Source is what I need to do, but I'm not sure. I can see various ways to effectively write out my Elem and read it into...