View Full Version : [Newbie] Need Help with Java!

May 26, 2012, 02:24 PM
So I'm not really the one organizing and coding this add-on.

The one coding the Mac version of the add-on is doing it in Java.
I'm trying to test out this, close to final, version of the add-on, but I get an error that is yet to be resolved. I need fast help or any help would be appreciated!

Mac OS X 10.7.3 Java SE 6


Error : java.io.FileNotFoundException: null/addon/debug/debug.log (No such file or directory)

I Hit OK* and Window reappears x3

Then: The java JAR file "Addon_Client.jar" could not be launched window.

Please help me :confused:

May 26, 2012, 04:07 PM
Open the Terminal application. You can find it in Applications -->Utilities.
Type this in the Terminal window :

mkdir -p .jffaddon/debug;touch .jffaddon/debug/debug.log

Your Screenshot link points to nothing useful. Post it as an attachment.

More info : http://docs.oracle.com/javase/1.4.2/docs/api/java/io/FileNotFoundException.html

May 26, 2012, 07:34 PM
Show the error to the person doing the coding. To me, it doesn't look like something you can correct without further instructions from them. Frankly, it looks like a bug in the code.

And I don't think kryten2's suggestion will fix it, because the problem is that "null" is being used as a directory name.

Error : java.io.FileNotFoundException: null/.jffaddon/debug/debug.log (No such file or directory)

If I had to guess, I'd say the code is doing something vaguely similar to this:
String someDir = somethingThatReturnsADirname();
String hopefulPath = "" + someDir + "/.jffaddon/debug/debug.log";
SomeKindOfOutputStream out = new FileOutputStream( hopefulPath );

The bug lies in how hopefulPath is assembled. By starting with "" and then appending, if someDir is null you'll get the actual string "null" in the result, and there won't be any NullPointerException. If it was done like this:
String hopefulPath = someDir + "/.jffaddon/debug/debug.log";

then there would be a NullPointerException instead of a string with literal "null" in it.

However it does it, the code eventually ends up with this string:

which it then tries to open for output (possibly for input, but that'd be abnormal for a log file). Because there's no directory actually named "null", the attempt to open the file fails.

Perhaps somethingThatReturnsADirname() is trying to read a system property, and you've failed to define that property. Or you think you've defined it but somehow made a mistake.

Without seeing the actual code, and knowing what it does and what it expects, I don't see how anyone here can give a definitive answer or solution. You need to talk to the code's author, show them the error message, and explain exactly what you did.

May 26, 2012, 11:50 PM
Ok Thanks for your fast reply's and help! I will keep you updated :)

@kryten: It didn't work :(