Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mrpersonality98

macrumors newbie
Original poster
May 24, 2007
2
0
Hi,

I am in deep deep **** (apologies for the language)

If anyone can please help.
I want a code in Java which can work in Intel Mac.
The code should check for the existence of anything in the predefined location.

For eg. If I click on a button, it should check whether a.txt exists in C:\JAVA - if yes - it should prompt "File Exist" - if no it should prompt "File Does not Exist"

I want this today. I would really appeciate if you could help me out in this.
You can send me the code at my gmail address - the username is vkmittal or you can send it through here

Remember it should be in Java which runs in Intel Mac

I would really owe a big time to you.
 

hsvmoon

macrumors newbie
Jul 31, 2006
24
0
Huntsville Al
basic code

Hi,

I am in deep deep **** (apologies for the language)

If anyone can please help.
I want a code in Java which can work in Intel Mac.
The code should check for the existence of anything in the predefined location.

For eg. If I click on a button, it should check whether a.txt exists in C:\JAVA - if yes - it should prompt "File Exist" - if no it should prompt "File Does not Exist"

I want this today. I would really appeciate if you could help me out in this.
You can send me the code at my gmail address - the username is vkmittal or you can send it through here

Remember it should be in Java which runs in Intel Mac

I would really owe a big time to you.

Below is the basic code idea you need to use. You just need to add the IO stuff.

Code:
File file = new File("C:\JAVA\a.txt");
if(file.exists())
{
//display a.txt exists
}
else
{
//display a.txt does not exist
}

This sounds like homework?
 

fishkorp

macrumors 68030
Apr 10, 2006
2,536
650
Ellicott City, MD
if you're running it from OS X you'll never get a 'true' value for something with a full Windows Path since no C:\ exists.

there is absolutely nothing in what you're asking that would be specific to an intel mac over any other java capable computer out there other than you'd need the correct JRE to run and JDK to build.

why not just Google for Java File IO and i'm sure an example will pop up. it's not complicated stuff.
 

kiang

macrumors regular
Apr 8, 2007
129
0
Why do you think the Java API exists?
file.exists() is a standard function in the class File, so if you just went to the API you would have found the answer in like 2 seconds....
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.