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

Username:   Password: 
 RegisterRegister   
 opening a file as a parameter
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Bo0sT




PostPosted: Wed Mar 25, 2009 9:58 pm   Post subject: opening a file as a parameter

I would like to know how to open a file type of my own choosing as a parameter to my Java program. What is the best way to do this, if it's posible to do in Java. I don't have any code down yet, I don't even know were to start.

Background info:
I want to do this because i'v been learning HTML, XML, XSLT, CSS and Javascript and i'v decided that I want to make a website. For the navigation I wanted to have an XML file containing info on each link in the navigation bar and style the data using javascript. This has been really difficult to learn to do and i'm even getting mixed messages about if it's even possible or not. So my idea is to have a binary file that contains the data the XML file would have had, properties of each link in my navigation bar. Then have a program that takes this data and uses it to generate the javascript code that will style my data to look like navigation. The idea is easy navigation editing, being able to add and delete links easily. I would have each navigation save as a diffrent data file, give the data file a custom and unused extention.

*Bottom line: I would like the navigation data file to open like a .txt, but instead of bringing up the text editor or notepad or w/e, have it bring up my program with the contents of the file loaded in.


Any help is appreciated.
Sponsor
Sponsor
Sponsor
sponsor
[Gandalf]




PostPosted: Wed Mar 25, 2009 10:35 pm   Post subject: RE:opening a file as a parameter

Use the String[] args parameter of the main method to fetch whichever command line argument is the name of the file, then open it using a Scanner object or something of that sort.
Bo0sT




PostPosted: Wed Mar 25, 2009 10:36 pm   Post subject: Re: opening a file as a parameter

oooooo thats wut thats for =D

cool thanks, ill try that.
DemonWasp




PostPosted: Thu Mar 26, 2009 1:26 am   Post subject: RE:opening a file as a parameter

Side note: Java != Javascript. Though similar in some of their syntax, the two are totally distinct languages.
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 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: