【问题标题】:how to configure eclipse run configurations for System Properties (ssl/tls) in command line arguments如何在命令行参数中为系统属性(ssl/tls)配置 eclipse 运行配置
【发布时间】:2013-09-06 15:46:58
【问题描述】:

我的命令行输入是在没有 IDE、java 的情况下运行时 -

Djavax.net.ssl.trustStore="d:/xxxLS/xxxx.jks" 
-Djavax.net.ssl.trustStorePassword=posclient 
pDevice.ClientMain 1 d:/xxxLS/xxsSslxxxClient.jks 
possslandencryptclient possslclient posencryptclient localhost 7866 SslYes EncYes

当我尝试在 Eclipse 中运行应用程序时,它不起作用。如何在 Eclipse 中指定 SSL/TLS 密钥路径。我的磁盘中有密钥文件。(xxxx.jks, xxsSslxxxClient.jks)

我不知道如何为特定的命令行参数配置我的 Eclipse。 文件名(待执行)Device.ClientMain

请帮帮我。

【问题讨论】:

    标签: java eclipse ssl command-line-arguments


    【解决方案1】:

    是的,我得到了解决方案,将 TLS/SSL 密钥放置在 eclipse 运行 -> 运行配置 -> 在 Main 下选择要运行的类, -> (X)Arguments 提供了您要包含的关键详细信息在 VM 参数下,在 Program Arguments 下传递常用的命令行参数。在运行 SSL 层客户端/服务器应用程序时,密钥列表或密钥详细信息应包含在 VM 参数下。我的程序运行良好。

    在详细信息中,Arguments 分为 Program Arguments,Eclipse 中的 VM arguments,Program arguments 是传递给应用程序的参数,可通过 main 方法的“args”字符串数组参数访问。 VM 参数是传递给 Java 软件解释器的系统属性等参数。

    VM 参数在调用 Java 解释器(即“java”)之后和 Java 类之前。程序参数跟在你的 Java 类之后。

     Public class ArgsTest {
    
    public static void main(String[] args) throws IOException {
    
        System.out.println("Program Arguments:");
        for (String arg : args) {
            System.out.println("\t" + arg);
        }
    
        System.out.println("System Properties from VM Arguments");
        String sysProp1 = "sysProp1";
        System.out.println("\tName:" + sysProp1 + ", Value:" + System.getProperty(sysProp1));
        String sysProp2 = "sysProp2";
        System.out.println("\tName:" + sysProp2 + ", Value:" + System.getProperty(sysProp2));
    
    }
    

    } 将输入传递为 java ArgsTest -DsysProp1=sp1 -DsysProp2=sp2 pro1 pro2 pro3

    Output would be:
     Program Arguments:
    pro1
    pro2
    pro3
     System Properties from VM Arguments
    Name:sysProp1, Value:sp1
    Name:sysProp2, Value:sp2
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-02-18
      • 1970-01-01
      • 2015-07-03
      • 1970-01-01
      • 2018-10-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多