Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

how to run a java .class file with command line arguments from the console

Please login with a confirmed email address before reporting spam

Hello,
How can I pass (command line) arguments to a .class file when starting it from the console? The public static void main(String[]) method of my class parses its arguments to set parameters of the device being simulated, and to determine what simulation tasks to perform. When called from within the desktop (i.e. no arguments given), it pops up a window to ask the user for these arguments - but as the next step I would like to run this class from the command line, specifying all parameters and tasks as command line options. Can this be done?
I have 4.3b
Thank you
Daniel

[edit: I know how to pass command line args to a java program, but I guess with comsol I do not run these .class file as "java myclass.class arg1 arg2...", but with comsolbatch]

1 Reply Last Post 10.01.2014, 10:49 GMT-5

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 10.01.2014, 10:49 GMT-5
Sorry, the answer:
add ModelUtil.initStandalone(true|false); to the beginning of the main method, and run it as a normal java app... Sorry for the question.
as described on page 17 here: nf.nci.org.au/facilities/software/COMSOL/4.3a/doc/pdf/mph/COMSOLJavaAPIReferenceGuide.pdf
Sorry, the answer: add ModelUtil.initStandalone(true|false); to the beginning of the main method, and run it as a normal java app... Sorry for the question. as described on page 17 here: http://nf.nci.org.au/facilities/software/COMSOL/4.3a/doc/pdf/mph/COMSOLJavaAPIReferenceGuide.pdf

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.