Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

regarding JDK1.7 release

 
pavithra M K
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
pavithra M K
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
pavithra M K
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, how to convert a File into a FileObject:
But man, is it hard to get through that mess...
 
pavithra M K
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot for your efforts on it.
Code helped me a lot.
 
Rob Spoor
Sheriff
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic