Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

passing files as parameters

 
sayush anand
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 331
Python Ruby Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 679
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic