Win a copy of Java by Comparison (eBook) this week in the Java in General forum!

Lukas Casier

Greenhorn
+ Follow
since Sep 11, 2012
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Lukas Casier

Ulf Dittmer wrote:On Windows you need to use semi-colons instead of colons to separate classpath entries.



Indeed, it's surprising how many wrong answers there are for this question. Thank you, issue resolved.
4 years ago
Hi,

I am trying to compile a .java file (TransformRTDE.java) that uses several import statements. These statements import .class files present in five external JAR files: dataextract.jar, jna.jar, JRI.jar, JRIEngine.jar and REngine.jar. I have read documentation on how to deal with these import statements while trying to compile your .java file from the command line. However, I do not seem to succeed.

I set up the directory in the command line to be the folder in which my .java file resides. In that same folder, I have put the JAR files. When I try to compile the code using java -cp dataextract.jar:jna.jar:JRI.jar:JRIEngine.jar:REngine.jar TransformRTDE.java, I get a package does not exist error. I have set up the class path to include the folder in which all my .java and .jar files reside.

I have searched for hours on this without success. Any ideas what I'm doing wrong?

Thanks in advance!

4 years ago
Guess what ...
System.gc() doesn't work anymore. I think it's weird. Tried thread.sleep(..) but that doesn't work either.
I'll check my other methods closely now for any manipulation of the file 'test'.
EDIT: found that fstream wasn't closed in a method that is being called right before markasRead. Have been searching for so long and i'm always careful to close the resources after use. Really stupid mistake.
Everything seems to be working fine now (tested 3 times).
Thank you very much . Happy I finally found my mistake.
5 years ago

Rishi Shah wrote:

Lukas Casier wrote:

System.gc() call simply SUGGESTS that the VM do a garbage collection and it also does a FULL garbage collection (old and new generations in a multi-generational heap), then it can actually cause MORE cpu cycles to be consumed than necessary.



So you mean I should further look into it until I've found the real problem? It's working for now



So, you're just calling this method in your main method?



Nope, I'm calling this in my finally block just before the file.delete();
5 years ago
System.gc() call simply SUGGESTS that the VM do a garbage collection and it also does a FULL garbage collection (old and new generations in a multi-generational heap), then it can actually cause MORE cpu cycles to be consumed than necessary.

So you mean I should further look into it until I've found the real problem? It's working for now
5 years ago
System.gc() did the trick. No idea why I had to run the garbage collector to clear up unused objects as I close them all, but it works now.
EDIT: in a response to previous post:
1) That was a solution I found on the Internet. Worked for some people so I decided to give a try (you never know). But completely useless.
2) The boolean was false (before the System.gc())
3) I'll try to remember that
5 years ago
I've changed the code to this:

No exceptions are thrown.
File hasn't been deleted and tempfile still exists in the folder.
EDIT: tempfile has the proper lay-out and has been changed in the right way. Only deleting the file and renaming the tempfile just won't work....
5 years ago
Hi all,

I've got problems deleting a file and renaming a tempfile. The file just won't delete and as a consequence the tempfile won't change name. I've tried everything and been looking into it for a long time now. All the readers and writers are (in my opinion) properly closed before I try to delete or rename.
The code:

I've done deleting and renaming in other methods and I do exactly the same thing but in this method, it just doesn't work.
Also, the file isn't open. (not in use by Windows)
Any ideas?
5 years ago