RanSch
RanSch

Reputation: 469

java get current file content

I created a new extension with jnlp - I used the association tag. after clicking a file with the special extension, It's open the program. How the program can get the content of the file?

Upvotes: 1

Views: 137

Answers (2)

Andrew Thompson
Andrew Thompson

Reputation: 168825

The file services demo. has a complete example of declaring the .zzz extension.

Basically the file name is passed as a String in the arguments to the main(String[]) method. The arguments is preceded by a string with either open or print.

Once the code has the file name, create a File and load it as you might load any other file.

Upvotes: 1

MadProgrammer
MadProgrammer

Reputation: 347214

The file in question would be past in as an argument to the main program.

From there, you would read the file as normal

Upvotes: 2

Related Questions