This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hide opened file using java

 
monicka rk akilan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Am new to this site..
I need to hide lastly opened file using java..
thanks
 
Winston Gutkowski
Bartender
Pie
Posts: 10422
63
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
monicka rk akilan wrote:I need to hide lastly opened file using java.

Welcome to JavaRanch, Monicka.

A few things for you:
1. EaseUp (←click) - We're all volunteers here, and urgency is your problem, not ours.
2. TellTheDetails (←click) - Right now, I have no idea what you mean by 'hide lastly opened file'.

My suggestion: explain, in English, and in detail, what you're trying to do, and where this 'hiding' business comes in.

A few pages that might help you to ask your question a bit better:
HowToAskQuestionsOnJavaRanch
How to provide an SSCCE
How to ask questions the smart way

Winston
 
monicka rk akilan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi winston

i need to print a text file using Desktop class.
when i use that that file is first opening and then print..
but i no need to make that file visible to user.
how to hide that file..
 
fred rosenberger
lowercase baba
Bartender
Posts: 12145
30
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you asking how to make the operating system not see a file if it has been opened in Java?
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15356
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Monicka, welcome to the Ranch.

Remember that we don't know anything at all about your program. That means you have to explain in detail what your program does, what it looks like, and what exactly you want to change. For example, we have no idea where and how the "opened file" is displayed or even what exactly you mean by that. Is your application a web application, or a desktop application? Does the opened file appear in a "recently used files" menu and you want to hide it from there? Or is your question about something entirely different?

We can't give you any useful answers unless you explain in detail what you mean.
 
Tony Docherty
Bartender
Posts: 2965
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this is beyond the control of your application when launching the print via the Desktop class. I believe the Desktop class just executes the Print command for the application associated with this file type. What happens next is up to the application.

Some applications such as Word have command line switches that allow you to control their behaviour but you would then need to launch the application via Process so you would need to know the correct application to use for your file, the path to the application and what switches to add.
 
monicka rk akilan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai every one... thanks for your suggestion...
this is my code....
---------------------------------------------------------------------
------------------------------------------------
when i run this code the file is showing first and then printing...
i dont want to show the file....
Without showing the file. i want to print directly....
thanks in advance.

How to make this with out show file....

-Monicka Akilan
 
Tony Docherty
Bartender
Posts: 2965
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please UseCodeTags (← click) when posting code as it makes it easier for people to read your code. I've added them for you this time.

What application is opening to print the file, and is it closing after printing?

As I said in my previous post you can't control the visibility of the application. If your application isn't closing after it has printed and you are on a Windows machine you can print text files using Notepad by using java.lang.Process (created from java.lang.ProcessBuilder) ie:
This will open Notepad displaying the file, print it and then close notepad.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic