java

Java System-Wide Keyboard Shortcut

Is there any way to get a system-wide (global) keyboard shortcut to perform an action in a Java application? Any AWT/Swing bindings? ...

Java Swing: Libraries, Tools, Layout Managers

What libraries/tools do you have in your Java Swing Tool set? XUL Layout Managers Packagers/Installers Books etc..... ...

Can IntelliJ create hyperlinks to the source code from log4j output?

In the IntelliJ console, stack traces automatically contain hyperlinks that bring you to the relevant source files. The links appear at the end of each line in the format (Log4jLoggerTest.java:25). I can configure log4j to output text in a similar format. log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE} (%F:%L) - %m%n In...

How can I get this program to also print the first entry in the list too?

I can't display the first entry from my query that returns multiple answers. For example, a search with a result set of five will return the second to fifth and miss the first entry. If I search for something that has one entry as output it doesn't return anything but just hangs because it is the first and only entry in the database. ...

How I can decrease time response from Open Office Service using JOD Coverter to Print to PDF?

We are currently using JOD Converter to send a word document to an open office service running in a different machine. The open office service is being hosted in a facility were they guarantee 100 Mbps bandwidth, we have three servers that print to this server hosting the open office service. 1. Amazon Cloud server (staging) takes abou...

Servlet URL pattern to match a URL that ends with a slash ("/")

I'd like to specify a Servlet URL pattern to match a URL that ends with a slash ("/") and only a slash. I understand that the pattern /example/path/* will match a URL of http://example.com/example/path/ and that this appears to work. However, that same pattern would also match URLs of http://example.com/example/path/a/ ...

Where are the class files located in JDK folder?

This may sound like a stupid question. Where are the core class files from Sun, like Button.class, located in the JDK installation folder C:\Program Files\Java\jdk1.5.0_12? Or do the class files reside in C:\Program Files\Java\jre1.5.0_12 folder? ...

How do I separate out query string params from POST data in a java servlet

When you get a doGet or doPost call in a servlet you can use getparameterxxx() to get either the query string or the post data in one easy place. If the call was a GET, you get data from the url/query string. If the call was a POST, you get the post data all parsed out for you. Except as it turns out, if you don't put an 'action' attrib...

What is xdoclet? (from a C-programmer point of view)

Question from a C-guy who has to work with some java code that is connected to my C-code via JNI. I have to work on the build-system, and I'm trying to change that from a shell-script to a proper makefile. For the C-part that's easy, but the java side somehow involves xdoclet stuff. I haven't yet found out what xdoclet is all about, a...

How to change the file's permission and last modified in Java?

To my knowledge, Java's File class does not support to change the file's permission and last modified date. Is there any proper way to do this in a cross-platform style? ...

JSP as Email template

Is there a way to send a MIME email in which the body of the email is derived from a JSP? I need to send an email with Javamail which contains a table and I figure it would be convenient if I could use a JSP to do all the formatting and layout. ...

Using a long as ArrayList index in java

I am writing this java program to find all the prime numbers up to num using the Sieve of Eratosthenes, but when I try to compile, it says I can't use a long var as an array index, and it expects an int var in its place. But I'll be working with large numbers, so I can't use int. What can I do? import java.util.*; import java.lang.*; p...

JVisualVM problem with monitoring JBoss

I want to monitor my application running inside JBoss version 3.2.5 using JVisualVM. I have installed my app to run ass windows serivce. JVisualVM sees my application but i can't see neither thread dump or heap dump. Profiling is not possible either. I get an error dialog with an error icon but with no text. Any ideas? ...

From C Source to Java Bytecode?

I'm looking for a way to compile C source code into high-performance Java bytecode. I've successfully used NestedVM, but the performance hit is not acceptable for a project I'm working on. I've also seen various open source projects aimed at this problem and a couple of commercial products. This SO question deals with general problem o...

Is there a java hash structure with keys only and no values?

I'm looking for a structure which hashes keys without requiring a value. When queried, it should return true if the key is found and false otherwise. I'm looking for something similar to Hashtable<MyClass, Boolean> except insertion requires only a key and queries only ever return true or false, never null. ...

How to hide the .jsp extension in my web server urls

I have a JSP web server, with pages that all end with the .jsp extension. How can I hide it in my web server urls without resorting to non-java tricks (e.g., apache rewrite)? For example: instead of typing http://www.sample.com/search.jsp?xxx the user would just type http://www.sample.com/search?xxx ...

How do you set the time and only the time in a calendar in Java?

Having the hours and minutes, is there any easier or better way to set it into a Calendar object than: calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), hour, minute); ...

write data to exel file using jexcelapi in java

Hi, i'm begginer in java i have created exel file and write to that file by using jxl API. but the file is taking 14kB but in VC++ it will create with 2KB i not getting what is the reason,shall i have to use another way to do the coding plz help me to solve the problem thanks. ...

How to use classes from .jar files?

I read the Java tutorials on Sun for JAR files, but I still can't find a solution for my problem. I need to use a class from a jar file called jtwitter.jar, I downloaded the file, and tried executing it(since I came to know yesterday that .jar files can be executed by double clicking on them) and Vista gave me an error saying "Failed to ...

Why was "new Date(int year, int month, int day)" deprecated?

My application I've recently inherited is FULL of deprecation warnings about the constructor: Date d = new Date(int year, int month, int day) Does anyone know or can point to a reason why something as simple as this was "replaced" with something like this: Date d = new Date(); Calendar cal = GregorianCalendar.getInstance(); cal.set(1...