Skip to main content

parameter for the cvm.exe call

1 reply [Last post]
mkant
Offline
Joined: 2010-02-03

Hello,
why is it not possible to add a own (e.g. "test") parameter to the call?
Best regards,
Mathias

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
davyp
Offline
Joined: 2007-01-03

Hi Mathias,

If you want to add a command line parameter to cvm.exe (like in '-cp' for specifying the classpath),
then the answer is no. You could however declare a system property that your application can look for:

cvm.exe -Dname="john" -cp \path\to\application.jar MainClass

Your application can then read this property with System.getProperty("name"); If you want to specify
a parameter to your application itself, as in

cvm.exe -cp -cp \path\to\application.jar MainClass john male 42

then you can get these parameters from your main method:

public class MainClass {
public static void main (String[] args) {
System.out.println(args[0]);
System.out.println(args[1]);
...
}
}

Davy