在java中使用命令行输入

时间:2015-09-01 12:55:10

标签: java lotus-notes

我正在尝试从main中的命令行读取输入,然后在我的代码的public void部分中打开该文件。我怎样才能在我的代码中执行此操作?

package dev;

import java.util.Date;
import java.util.List;
import java.util.Vector;
import java.util.Collection;
import java.util.Collections;
import java.text.SimpleDateFormat;
import java.util.ArrayList;

import lotus.domino.*;
public class platform1 extends NotesThread implements Comparable <platform1>
{
  public static void main(String[] argv)
  {
    platform1 t = new platform1();
    t.start();
  }
  public void runNotes() 
  {
   try
   {
    Collection NotesDates = new ArrayList();
    Session s = NotesFactory.createSessionWithFullAccess();
    Database db = s.getDatabase("" , (I want to open argv[0] here));

1 个答案:

答案 0 :(得分:0)

感谢指导我传递变量,我正在寻找的是我如何做到这一点。我发现这有效:

package dev;

import java.util.Date;
import java.util.List;
import java.util.Vector;
import java.util.Collection;
import java.util.Collections;
import java.text.SimpleDateFormat;
import java.util.ArrayList;

import lotus.domino.*;
public class platform1 extends NotesThread implements Comparable <platform1>
{

    private String nsfarg;

    public static void main(String[] argv)
  {
    platform1 t = new platform1(argv);
    t.start();
  }
    private platform1(String[] argv){
        this.nsfarg = argv[0];
    }
  public void runNotes() 
  {
   try
   {
    Collection NotesDates = new ArrayList();
    Session s = NotesFactory.createSessionWithFullAccess();
    Database db = s.getDatabase("" , (this.nsfarg.toString()));