28 December 2005

Java is portable?

Snippet for a java code:

public static MultipartRequest createMultipartRequest (HttpServletRequest req)
throws IOException
{
[SNIP]

// Create a temp directory for the attachments
Runtime.getRuntime().exec ("mkdir -p " + Constants.UPLOAD_PATH);

File check = new File (Constants.UPLOAD_PATH);

[SNIP]

}


What wrong with this code? The answer is, this code is not portable, i.e. doesn't work on Windows. Nothing wrong with the Java, the problem is the programmer itself. :D

I got this snippet from a discussion in The Daily WTF.
Post a Comment