Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGL Development Tools » EGL Program: parameters to main function(question)
icon5.gif  EGL Program: parameters to main function [message #1010160] Sat, 16 February 2013 18:26 Go to next message
Gilbert Herschberger is currently offline Gilbert Herschberger
Messages: 12
Registered: September 2010
Junior Member
How do I access command line parameters in EGL-EDT 0.8.2?

I am generating from EGL to Java with EGL Development Tools version 0.8.2. I create runnable JAR files.

$ java -jar eglprogram.jar value1 value2 value3


While it's a hack, I have resorted to defining Java system properties and using SysLib.getProperty().

$ java -Darg1=value1 -Darg2=value2 -Darg3=value3 -jar eglprogram.jar


EGL in RBD 7.5+ provides a SysLib.getArguments() function to return parameters to the main function in an EGL program. Is there some other equivalent?

[Updated on: Sat, 16 February 2013 18:28]

Report message to a moderator

Re: EGL Program: parameters to main function [message #1011046 is a reply to message #1010160] Mon, 18 February 2013 18:19 Go to previous messageGo to next message
Justin Spadea is currently offline Justin Spadea
Messages: 66
Registered: July 2009
Member
Hi Gilbert,

I took a look and this is something that we currently don't have. I don't think it was intentional, just something we missed. I've opened up https://bugs.eclipse.org/bugs/show_bug.cgi?id=401111

-Justin
Re: EGL Program: parameters to main function [message #1012075 is a reply to message #1011046] Wed, 20 February 2013 20:40 Go to previous messageGo to next message
Gilbert Herschberger is currently offline Gilbert Herschberger
Messages: 12
Registered: September 2010
Junior Member
Thank you for your quick response. Your right. In RBD, there are two functions: getCmdLineArg() and getCmdLineArgCount(). Meanwhile, I'm looking at writing a short-term work-around using a custom Java class and an external type in EGL. I am using these function names for the work-around external type. Thanks,
icon1.gif  Re: EGL Program: parameters to main function [message #1014036 is a reply to message #1012075] Mon, 25 February 2013 02:34 Go to previous message
Gilbert Herschberger is currently offline Gilbert Herschberger
Messages: 12
Registered: September 2010
Junior Member
I have written an external type and Java class that returns command-line arguments. (And, no, I didn't match the RBD API.)

An EGL source file called "JavaArguments.egl" in the EGL Source folder:

package lab.lesson21;

import eglx.java.JavaObject;

externalType JavaArguments type JavaObject{PackageName = "lab.lesson21.java"}

    constructor();

    function getArguments() returns(string[]?);
end


A Java source file called "JavaArguments.java" in the src folder.

package lab.lesson21.java;

import java.util.List;
import java.util.Vector;

import org.eclipse.edt.javart.Runtime;

public class JavaArguments {
	public JavaArguments() {
		super();
	}

	public List<String> getArguments() {
		List<String> result = new Vector<String>();
		String[] list = Runtime.getRunUnit().getStartupInfo().getArgs();
		int iMax = list.length;
		for (int i = 0; i < iMax; i++) {
			result.add(list[i]);
		}
		return result;
	}
}
Previous Topic:Browser compatiblity
Next Topic:How do you convert a string to a date?
Goto Forum:
  


Current Time: Sat Sep 20 16:08:45 GMT 2014

Powered by FUDForum. Page generated in 0.01958 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software