Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Clearing the Screen
Index -> Programming, Java -> Java Help
Goto page Previous  1, 2, 3
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ProgrammingFun




PostPosted: Fri Dec 31, 2010 6:47 pm   Post subject: Re: Clearing the Screen

@SS1389: You sound sarcastic...

How can I use the code given below to open a file which is in the same directory as the Java file?
Java:

Runtime.getRuntime().exec( "cmd.bat /E:1900 /C MyCmd.cmd" );


I was trying to open a file in notepad (or Word if it can work) so I did the following:
Java:

Runtime.getRuntime().exec( "notepad.exe /C:1900 /C test.txt" );


This opens up notepad but it cannot find the file which I have defined.
What do I need to do with this part:
Java:

/E:1900 /C test.txt


so that it can open up the file in the same directory as the program?
Sponsor
Sponsor
Sponsor
sponsor
jcollins1991




PostPosted: Fri Dec 31, 2010 7:05 pm   Post subject: Re: Clearing the Screen

I don't see any reason to need "/E:1900 /C test.txt". It's probably just executing something as it would in the command line, so just doing "notepad.exe FILE" or "notepad.exe C:\\PATH\\TO\\FILE".
ProgrammingFun




PostPosted: Fri Dec 31, 2010 7:21 pm   Post subject: Re: Clearing the Screen

jcollins1991 @ Fri Dec 31, 2010 7:05 pm wrote:
I don't see any reason to need "/E:1900 /C test.txt". It's probably just executing something as it would in the command line, so just doing "notepad.exe FILE" or "notepad.exe C:\\PATH\\TO\\FILE".
I believe that part defines which file to open (though I am not sure)
If I just leave it as "notepad.exe", only a new instance of notepad will be opened whereas I want to open a txt file for the user to read....
SS1389




PostPosted: Fri Dec 31, 2010 8:32 pm   Post subject: Re: Clearing the Screen

It was a bit sarcastic... Mr. Green
copthesaint




PostPosted: Fri Dec 31, 2010 11:38 pm   Post subject: Re: RE:Clearing the Screen

Tony @ Fri Dec 31, 2010 wrote:
This will be of interest to this thread
http://twitter.com/#!/camilleroux/status/20913572372549632
code:

ruby -e 'def a;10.times{puts " "*rand(79)+"*"};end;99.times{a;puts " "*34+"Happy New Year 2011";a;sleep 0.1;puts "\e[2J"}'


lol kinda random tony :p
Tony




PostPosted: Fri Dec 31, 2010 11:41 pm   Post subject: RE:Clearing the Screen

It clears a console's screen with "\e[2J"
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
ProgrammingFun




PostPosted: Sun Jan 02, 2011 8:00 pm   Post subject: Re: Clearing the Screen

jcollins1991 @ Fri Dec 31, 2010 7:05 pm wrote:
I don't see any reason to need "/E:1900 /C test.txt". It's probably just executing something as it would in the command line, so just doing "notepad.exe FILE" or "notepad.exe C:\\PATH\\TO\\FILE".
Oh....I get it now...thanks for the help.
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 3 of 3  [ 37 Posts ]
Goto page Previous  1, 2, 3
Jump to:   


Style:  
Search: