Newgrounds.com — Everything, By Everyone.

Checking login status…

USERNAME:

PASSWORD:

Logging in…

Logged in as:
.
Logging out…
Inbox My Account Log Out


Forum Topic: Opening Files in Java

(74 views • 3 replies)

This topic is 1 page long.

<< < > >>
None

Blaze

Reply To Post Reply & Quote

Posted at: 5/10/08 09:00 PM

Blaze EVIL LEVEL 21

Sign-Up: 08/04/05

Posts: 6,776

Why hello there young people :D

Uhm, i have a question (yeah i know you guys think its the only reason why i come here nowadays).

Thing is, i want to to open a chm file through java, i can open the file. But only if i give it a "full" dir, i want to know of a way to open the file if it's in the same directory as the classes, and will be in the same directory as the *.jar file. I don't want to go through the trouble of finding the actual file's dir to know where it is, something like "..\file.chm" :P

Any help appreciated, thanks a lot in advance. :D


None

LCurtis

Reply To Post Reply & Quote

Posted at: 5/10/08 09:45 PM

LCurtis NEUTRAL LEVEL 17

Sign-Up: 05/23/07

Posts: 1,077

import java.io.File;

public class Test1
 {
	public static void main(String[] args) 
	{
		File file = new File("test.txt");
		System.out.println(file.exists());
	}

}

When I run this (note the file path) it works just fine. However, when I tried to run it using eclipse it was printing out false. But when I ran it through console, it prints true. So you might just be having trouble because of your IDE.

support the dream ...

BBS Signature

None

Blaze

Reply To Post Reply & Quote

Posted at: 5/11/08 04:16 PM

Blaze EVIL LEVEL 21

Sign-Up: 08/04/05

Posts: 6,776

Well, actually i have to use the Netbeans IDE. And i'm working with forms and all... but thing is, i ran it and it does open the help file. :D Thanks a lot sir ^_^


None

everyoneloves345

Reply To Post Reply & Quote

Posted at: 5/11/08 05:11 PM

everyoneloves345 NEUTRAL LEVEL 05

Sign-Up: 07/25/06

Posts: 240

At 5/11/08 04:16 PM, Blaze wrote: Well, actually i have to use the Netbeans IDE. And i'm working with forms and all... but thing is, i ran it and it does open the help file. :D Thanks a lot sir ^_^

lol nice, I enjoyed that ^^


All times are Eastern Daylight Time (GMT -4) | Current Time: 12:02 AM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!