jdk1.6

How can my thread get stuck in isConnectionReset (PlainSocketImpl)

Someone helping me with a hung Java server studied the thread dump and does not understand the following state : INFO | jvm 1 | 2009/08/30 18:11:46 | "103468119@qtp-2047706572-1" prio=10 tid=0x0000000041758000 nid=0x13d7 waiting on condition [0x00007f6dbb75e000] INFO | jvm 1 | 2009/08/30 18:11:46 | java.lang.Thread.State: ...

Java 6: Examples for implementing own scripting language using javax.script?

Hello! I really can't find good examples for implementing own scripting language using javax.script ... I need just something to start. Documentations Examples Tutorials Videos Presentations slides (PDF) Note 1: I'm really not talking about javascript ;) Note 2: I don't need examples, how to use existing implementations, I want to ...

Java source upgrade from 1.4.2 to 1.6.0_10 recommended ? (skipping 1.5)

Our desktop-only product at work has been using JDK 1.4.2 until now (also 1.4.2 JRE shipped with product). I am trying to convince the management to let us upgrade to a newer version in order to get the performance, API/features and developer comfort benefits. Since 1.5 has reached EOL transition, I'm I thinking of the upgrade to 1.6.0...

java 1.6 SystemTray icon does not appear on windows startup

I have a Java 1.6 desktop application, started with javaw from a batch file on Windows XP. There is a .lnk link to this batch file, which is placed to windows Startup folder in order to start this application on every system boot. The application uses SystemTray class to display an icon on the system tray in case it is running. Starting...

How to set classpath when I use javax.tools.JavaCompiler compile the source?

I use the class javax.tools.JavaCompiler (jdk6) to compile a source file, but the source file depends on some jar file. How to set the classpath of the javax.tools.JavaCompiler? ...

Gotchas in JDK 6

Are there any gotchas in JDK 6 which did not exist in earlier versions? I am interested in finding out some surprising changes like the following one in the way Timestamp.valueOf() works. Timestamp.valueOf(), when provided with a timestamp which contains a date or a month with a single digit. eg. 2009-9-20, 2009-9-3, 2009-12-4 etc., beh...

XSLT 2.0 support in JDK 6?

Does JDK 6 support XSLT 2.0 for transformation. My question is, does it come with an XSLT processor built for XSLT 2.0? or DO I need to go for other libraries like Saxon. ...

JSON-Taglib library not working w/ SDK 1.6 ??

Hi guys, I'm currently working on a project that uses the json-taglib-0.4.1.jar library to do some json communication between front and back end. That library use to work fine until we migrated to Java 1.6 recently, we were compiling against 1.5 before that. On top of not working anymore, I read it's not available in public reposito...

Java: How to communicate between an annotation processor and another project?

Hello everyone! I have an own annotation processor (let's call it MyProcessor) and a project (let's call it MyProject) which uses the processor by passing -processor to javac. Now I need MyProcessor to produce some output and make it available for MyProject. I have following options (and problems): Let MyProcessor write a file to th...

Is there a Java utility which will convert a String path to use the correct File separator char?

I have developed a number of classes which manipulate files in Java. I am working on a Linux box, and have been blissfully typing new File("path/to/some/file");. When it came time to commit I realised some of the other developers on the project are using Windows. I would now like to call a method which can take in a String of the form "/...

How to tell why a file deletion fails in Java?

File file = new File(path); if (!file.delete()) { throw new IOException( "Failed to delete the file because: " + getReasonForFileDeletionFailureInPlainEnglish(file)); } Is there a good implementation of getReasonForFileDeletionFailureInPlainEnglish(file) already out there? Or else I'll just have to write it myself. ...

MySQL 5.1.32-community and JDK 1.6.0_16

Hello.I have this real weird exception when issuing a basic SELECT, using MySQL 5.1.32-community from JDK 1.6.0_16 code. The conditions to repeat : at any place in my app, if i change the date of my OS (WindowsXP SP3) and after that hit some refresh button, that is reloading info from database, while doing this multiple times (usually 2-...

Deprecate in Java 1.6

In Java 1.5, to deprecate a method you would: @Deprecated int foo(int bar) { } Compiling this in Java 1.6 results in the following: Syntax error, annotations are only available if source level is 1.5 Any ideas? ...

How to lock down (or sandbox) JDK's built-in Javascript interpreter to run untrusted scripts

Hi, we have a Java application and would like to run untrusted code using the built in Javascript interpreter (javax.script.*) However by default the interpreter allows access to any java class. For example "java.lang.System.exit(0)" in the script will shutdown the JVM. I believe this is called "Live Connect", see Sun's "Java Scripting ...

Java 1.4, compile java class from source file like ToolProvider class of the jdk 1.6

There is a standard way to compile a java class from a .java file like do the ToolProvider class of the jdk 1.6 but with Java 1.4: JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); int result = compiler.run(null, null, null, "Hello.java"); ?? Anyone have some idea. Many thanks. ...

TimeZone.setDefault changes in JDK6

Hello I just noticed that JDK 6 has a different approach to setting a default TimeZone than JDK5. Previously the new default would be stored in a thread-local variable. With JDK6 (I just reviewed 1.6.0.18) the implementation has changed, so that if the user can write to the "user.timezone" property, or if there is no SecurityManager i...

JSP compilation fails on Weblogic 10.3 but works on Weblogic 10

I have below piece of code in one my JSP <%@ page language="java" import = "import com.ecc.SiteAdmin.servlets.*" %> This file compiles and works fine on Weblogic 10 with Sun JDK 5, but fails with below message on Weblogic 10.3 with JRockit 6 SiteAdminLogin.jsp:1:36: No type with this name could be found at this location. <%@ pag...

Can't authenticate with different NTLM credentials in one session with java.net.URLConnection

When I access a HTTP server using the standard Java API (java.net.URLConnection), the credentials are "cached" after the first successful authentication, and subsequent calls to Authenticator.setDefault() have no effect. So, I need to restart the application in order to use different credentials. I don't observe this effect when Basic A...

get client IP for webservice on java 6 embbeded http server

Hi, I am implementing web service on java 6 weight light (embbeded) HTTP server jax-ws-web-services-without-java-ee-containers - for testing purposes - I want to get the client IP for each request. I tried to declare web service context in my web service class: @Resource WebServiceContext wsContext; then use its message context in ...

Most concise way to convert a Set<String> to a List<String>

I am currently doing this: Set<String> listOfTopicAuthors = .... List<String> list = Arrays.asList( listOfTopicAuthors.toArray( new String[0] ) ); Can you beat this ? ...