wood burning stoves 2.0*
The moose likes Java in General and the fly likes regarding JDK1.7 release Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "regarding JDK1.7 release" Watch "regarding JDK1.7 release" New topic
Author

regarding JDK1.7 release

pavithra M K
Greenhorn

Joined: Oct 17, 2006
Posts: 11


Hello,

I am working on a client product which requires new File I/o to be included. While browsing i came accross java.nio package in JDK1.7. I stared including it in my project. However, when i was going through the java.sun.com site i noticed that JDK1.7 download was listed below next release(earlest Access) tab. Here i want a clarification that, whether JDK1.7 is released and whether can we suggest customer to use JDK1.7 as i am trying to code my project on JDK1.7.

Thanks in advance,
Pavithra.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41600
    
  55
JDK 1.7 has not been released. You should not expect customers to have it for quite a while (certainly not for the next 18 months). Most people/companies will upgrade software when it's convenient to them, not when it's convenient for the developer.


Ping & DNS - my free Android networking tools app
pavithra M K
Greenhorn

Joined: Oct 17, 2006
Posts: 11
hello,

thanks for your reply. i want to know whether can we use packages (java.nio) or jar files which includes those class along with the JDK1.6 or something like writting my own class having the logic of classes in nio package. is that legal?

Thanks,
Pavithra.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41600
    
  55
I'm not quite following what you're proposing to do. If you expect your code to run on Java 6, then you can't use any of the new features. There's no way to break out some of the new functionality and somehow make it work with Java 6.
pavithra M K
Greenhorn

Joined: Oct 17, 2006
Posts: 11
Actually my requirement in my project to monitor a folder. Whenever a xml file gets added or xml file present in that folder gets updated i need to listen to those changes and parse the xml file to get the message. Do you have clue how we can approch that. I thought of using quartz but schedular will execute the job for every certain interval of time instead of executing the jod whenever folder gets modified.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41600
    
  55
I'd think that a frequently run (say, once per second) background task would work fine for this.

By the way, you don't need Quartz to schedule simple recurring tasks - the java.util.Timer and TimerTask classes work fine for that.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19680
    
  18

pavithra M K wrote:I thought of using quartz but schedular will execute the job for every certain interval of time instead of executing the jod whenever folder gets modified.

That's exactly what WatchMonitor does if the file system does not support listeners. Check out this thread.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
pavithra M K
Greenhorn

Joined: Oct 17, 2006
Posts: 11
Thank you all for your replies.

i have thought of using JDK1.7 API's for folder monitoring, however JDK1.7 is not yet released we cannot suggest this to customers. And we dont want to use Threads here.

Can i use quartz- job, schedular and trigger listener in this scenario.

JOb -to read the xml file.
trigger listener - to listen to the folder changes and execute the Job.

Actually i want to know how to use trigger listener or job listener or schedule listener in my Java Application.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19680
    
  18

Have you read the thread I linked to? It has a link to Apache Commons VFS which has listener support built in.
pavithra M K
Greenhorn

Joined: Oct 17, 2006
Posts: 11
i checked with the common VFS it looks like it has some API for File I/O and event handling. For that do we need to write a XML file or to include the VFS jar file in the CLASSPATH is enough.
pavithra M K
Greenhorn

Joined: Oct 17, 2006
Posts: 11
I tried to implement using VFS. I am finding it difficult to write a program to listen the folder changes.
Please share me with some exmaple programs.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19680
    
  18

Hmm yes, they have gone a bit overboard with the abstractions. I'm having the most trouble getting a FileObject instance. So let's get back to that later. The base code:
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19680
    
  18

Ok, how to convert a File into a FileObject:
But man, is it hard to get through that mess...
pavithra M K
Greenhorn

Joined: Oct 17, 2006
Posts: 11
Thanks a lot for your efforts on it.
Code helped me a lot.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19680
    
  18

You're welcome.

And let me say, I really look forward to Java 7 now. No way its WatchMonitor can be harder to work with than this!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: regarding JDK1.7 release