my dog learned polymorphism
The moose likes Java in General and the fly likes passing files as parameters Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "passing files as parameters" Watch "passing files as parameters" New topic
Author

passing files as parameters

sayush anand
Greenhorn

Joined: May 23, 2012
Posts: 13
Hi

I have a java application to verify digital signatures . The Generate.java class takes a file (for which signature is to be generated) as command line argument and stores two files in the bin folder , one with the public keyand other with the private key .
The Verify.java class takes 3 command line arguments , the public key file , the private key file , and the file for which signature was generated.

Instead of giving these as command arguments , can i permanently them permanently in the java programs by giving their file path or somethign ?

Any suggestions .. ?
Sumit Bisht
Ranch Hand

Joined: Jul 02, 2008
Posts: 302

While you can hardcode them in your code, it might not be a good solution.
Alternatives are to look in a file/resource bundle that contains the entries for these files.
sayush anand
Greenhorn

Joined: May 23, 2012
Posts: 13
I need to show the program today in college , hence was thinking of hardcoding it in the program .Can you please tell how to do that
Stuart A. Burkett
Ranch Hand

Joined: May 30, 2012
Posts: 322
sayush anand wrote:I need to show the program today in college , hence was thinking of hardcoding it in the program .Can you please tell how to do that

You replace the references to the command line arguments with string literals.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: passing files as parameters
 
Similar Threads
question on security. pls. comment.
Runtime error
Signed an applet
Help! Problem with Encryption!
Regarding Trusted Applets