Using Java/JVM as a Scripting Component in C++
I've been doing some research into the JNI and had a couple questions. Specifically, what I'm looking for is the use of Java / the JVM as a scripting language for a C++ application. I'd like to combine the speed of C++ as the application's core with the versatility and ease of use of Java as a scripting backend. I'm wondering if anyone knew of any projects that utilized this approach that I may be able to use as a reference point. I've been evaluating other languages, such as Lua and Python, but although Java's syntax is probably a lot more verbose the style of code, I believe, is a lot more cleaner then these other languages. I appreciate any assistance or direction that anyone may offer, thanks!
Java in of itself would not normally be used in this way. Most standard VMs run class files not java source. So to use it as a script language you would have to create class files first. To use this methodology you must start by investigating dynamically compilation.
The newer Java API contains a script language (which is not itself java.) There are also other implementations which run on a java VM. BeanShell is one.
Similar Messages
-
The binary code for the script is not found error for the Script component - SSIS 2012
Hi,
I'm implementing a SSIS 2012 pkg. For a data flow task, I'm using a Visual Basic 2010 script component with an Oracle input flow. For the script component I've an input column and I've created an output column. Inside the script code I've edited only inside
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer).
The written code is:
If Year(Row.OFFDATAORI) < 1900 Then
Row.OFFDATAORIconv = CDate(CStr("1900" + "-" + Right("00" + CStr(Month(Row.OFFDATAORI)), 2) + "-" + Right("00" + CStr(DatePart(DateInterval.Day, Row.OFFDATAORI)), 2))
Else : Row.OFFDATAORIconv = Row.OFFDATAORI
End If
It is to note that OFFDATAORI isn't the name of the input column for the script component.
When I close the script component I've an error about "The binary code for the script is not found".
Any helps to me, please?
ThanksHi,
I've solved. There was a syntax error, a bit hidden.
Bye -
Can we use Java Script in SAP BusinessObjects Web Intelligence 4.1?
Can we use Java Script or any other Script in BI 4.1 Web Intelligence? If possible please do let me know the method/process
Hi Kranthi,
You have option to read a cell content as html. else you will have to go for SDK. I think you will get better suggestions, if you can explain your requirement in a little detailed manner.
refer below links for more details about SDK.
http://bukhantsov.org/2013/04/how-to-create-a-webi-document-using-java-report-engine-sdk/
Regards,
Nikhil Joy -
Hi ,
I am trying to build a dynamic calculator in WAD which is as similar to one in Executive view in Cognos. The problem i am facing is, i can able to build a normal calculator by using java script but i am unable to read the key figure values from the analysis item on from the data provider in to by calculator by using on click function. I wanted to get the all the values in to a internal excel , so that my calculator can read the values from that. can any one help me on getting values in to internal excel by using java before the executing the web template ?...
Thanks in advance....
Jhon.
Edited by: sap bw on Jul 31, 2008 5:51 PM
Edited by: sap bw on Jul 31, 2008 5:52 PMI might not be understanding your question completely since you mention WAD and then Excel, but if you are asking how to get the key figure values using Javascript in WAD, you can go to the Dataprovider properties and enable 'Output Result Data'. This will embed an XML element into the HTML output that you can then parse using standard Javascript DOM navigation.
Hope this helps. -
SSIS script component to use defined connection manager to load data from a Oracle
In SSIS script compoment, I can connect to oracle with hard-coded connectionstring:
OracleConnection conn;
conn = new OracleConnection();
conn.ConnectionString = "Data Source=XE;User ID=hr;Password=******";
however, when I defined an connection managers in the script compoment and call it as follows:
IDTSConnectionManager100 connMgr;
OracleConnection conn;
public override void AcquireConnections(object Transaction)
connMgr = this.Connections.MyADONETConnectionManager;
conn = (OracleConnection)connMgr.AcquireConnection(null);
I got error below:
TITLE: Package Validation Error
Package Validation Error
ADDITIONAL INFORMATION:
Error at Data Flow Task source [Script Component C# Oracel HR Oracle [21]]: System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to class type 'Oracle.DataAccess.Client.OracleConnection'. Instances of types that represent COM
components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.
at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.HandleUserException(Exception e)
at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.AcquireConnections(Object transaction)
at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostAcquireConnections(IDTSManagedComponentWrapper100 wrapper, Object transaction)
Error at Data Flow Task source [SSIS.Pipeline]: Script Component C# Oracel HR Oracle failed validation and returned error code 0x80004002.
Error at Data Flow Task source [SSIS.Pipeline]: One or more component failed validation.
Error at Data Flow Task source: There were errors during task validation.
(Microsoft.DataTransformationServices.VsIntegration)
I did not find any example for Orale. A similar SQL server example is as linked below:
http://technet.microsoft.com/en-us/library/ms135939(v=sql.110).aspx
can anybody shed some light? I appreciate it...
thanks,
SteveYou need to create a connectionmanager for Oracle connection and use it within the script task
See
http://www.mssqltips.com/sqlservertip/1787/oracle-parameterized-queries-in-sql-integration-services-ssis/
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Hi,
I am trying to fetch properties of all lists of "Survey Type" from my site collection in SharePoint 2013 using script editor web part. I am able to fetch properties of one list by mentioning its name explicitly in code but not all survey
list.
My task is to display Survey name , description ,Time created and URLs of all survey lists using java script in script editor web part.
And let me know , if there is any other OOB feature of SharePoint 2013 to achieve the same.
Here is the code :
<script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
SP.SOD.executeFunc('sp.js', 'SP.ClientContext', sharePointReady);
function sharePointReady() {
GetSurveyList();
function GetSurveyList() {
var spListTitle = " List Name";
var clientContext = new SP.ClientContext.get_current();
var oWeb = clientContext.get_web();
this.surveyList = oWeb.get_lists().getByTitle(spListTitle);
clientContext.load(surveyList);
clientContext.executeQueryAsync(Function.createDelegate(this, this.GetListProperties),Function.createDelegate(this, this.onFailure));
function GetListProperties() {
$("#SurveyList").text("");
var surveyTable = "<table border=1>";
surveyTable = surveyTable.concat("<tr><td>Survey Name</td>");
surveyTable = surveyTable.concat("<td>Survey Description</td>");
surveyTable = surveyTable.concat("<td>Time Created</td>");
surveyTable = surveyTable.concat("<tr><td>" + surveyList.get_title() + "</td>");
surveyTable = surveyTable.concat("<td>" + surveyList.get_description() + "</td>");
surveyTable = surveyTable.concat("<td>" + surveyList.get_created().format("MM/dd/yyyy hh:mm tt")+ "</td>");
surveyTable = surveyTable.concat("</table>");
$("#SurveyList").append(surveyTable);
function onFailure(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
</script>
<div id="SurveyList"></div>Shifa,
Please use search result webpart or content query webpart to list all survey list.
Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply. -
How to pass parameters to a page invoked using java script.--- Very Urgent.
Hello,
I have an advanced Table in my page. In the first column there is a
messageChoice. In the second column there is link item.On the link item i have set the following value for destination uri.
javascript:var a=window.open('OA.jsp?page=/AutoSales/oracle/apps/per/auto/webui/AutoSurrogatesPG&retainAM=Y','a','height=500,width=900,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbar=yes'); a.focus();
The user selects a value from the message choice and when he clicks on the link item, the value selected from the list should go to the new page invoked using java script as a parameter. I need the value selected from choice to generates few fields in the new page. I have preferred java script because i need the base page and a model window should open. I have tried using setForwardUrl() and setting '_blank' and new window for target frame property on the link item. But it isnt working. The new page is opening in the same window.
I have also tried putting the value in a session.
Please help with any kind of suggestions or solutions.
Thank you.Uma,
You need to
- Have a PPR Action on the messageChoice (this would trigger a form submit to populate the underlying View Attribute)
- Either
- Retrive the value from the View Attribute in the pop-up page (as I could see that you are retaining the AM)
- Use a SPEL in the link (on the modal page) to use the value from the View Attribute as the parameter value (in the form ${oa.current.<ViewAttributeName>)
HTH -
How to pass values to variables in WAD 7.0 using java script
Hi.,
My requirement is based on WAD 7.0.
The sales value has to displayed in WAD using graph with various chart types.
I have created variables for plant and material group in a query.
I have created drop down box for plant with all plants in it, check box for material group and a Submit button in WAD in FORM tag of HTML coding.
Once all the values are set in drop down box, checkbox and if the user clicks on submit button, the values has to captured by the variables for which I have created and the graph has to be aligned to the new values in variables.
Kindly help me how to use java script to get the values from FORM and pass it to variables.
Regards,
SelvaHi Selva,
You do not need to use Javascript for this. Instead you can achieve this by using API Commands in WAD 7.0.
Please configure Action on the ButtonGroup webitem to use 'Commands'.
->Choose Command 'Set Variables Values / SET_VARIABLES_STATE' under Commands for Web Templates
->Set Display Variable Screen setting to OFF
->Choose Query Variable for Plant, Select Variable Type as 'Binding Type', Binding Type as 'Data Provider Selection', Data Provider as the one you have assigned to the Dropdown webitem, Characteristic as 0PLANT or as that assigned to the Dropdown webitem
->Repeat above steps for Query Variable Material Group
Now when you make a selection from the Dropdown webitems, the Chart output will change accordingly. Let me know if this helps.
--Priya -
How to get the context data using java script in interactive forms
Hi All,
How to get the context data using java script in interactive forms by adobe, am using web dynpro java
thanks.Hi venkat,
Please Refer this link.
Populating one Drop-Down list from the selection of another Drop-down list
Thanks,
Raju. -
Display pop ups in the jsp by using Java script
Hi
can any body say ,how to display pop ups in the jsp by using Java script ?that's correct. You can use the below code for AJAX request.
<script type="text/javascript">
var httpObject = getHTTPObject();
//create XMLHttpRequest object
function getHTTPObject() {
var xmlhttp;
if (window.XMLHttpRequest) // if Mozilla, Safari etc
xmlhttp = new XMLHttpRequest();
else if (window.ActiveXObject){ // if IE
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
catch ( e ){
try{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
catch ( e ){}
return xmlhttp;
//define the function to send the request
function sendRequest(){
var currDesc = document.getElementById("description").value;
var URL = "manageMaintAction.do"; //action mapping in your struts-config
var queryString = "currDesc="+escape(currDesc); //get the currDesc value in your action class like request.getParameter("currDesc")
httpObject.open( "Post", URL, true );
httpObject.onreadystatechange = cbFn;
httpObject.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded");
httpObject.send(queryString);
//callback fn
function cbFn() {
if (httpObject.readyState == 4)
if (httpObject.status == 200)
var result = httpObject.responseText;
alert(result);
</script> -
How to use Java Script in Oracle Forms 10g
Hello,
Appreciate if anyone could help me using Java Script in Oracle Forms 10g?
Thanks
GMThank you for your reply. I was reading on the metalink that we could use the to call the java script from oracle Forms 10g (Doc ID 265863.1)
Example:
WEB.SHOW_DOCUMENT ('javascript:void(window.open("http://www.oracle.com","","location=no,toolbar=no,menubar=no,status=no,"));self.close()','_blank');
I tried it but it did not open the any window as it claims. Am I missing anything? Is there any IE related setting which I need to modify for the above to work?
Regards
GM -
Acrobat standard 9.0 error while enabling commets option using Java script object
I'm using the below java script code in my VB 6.0 application for enabling commets options in the PDF file
Dim oJSO As Object
Set oJSO = mPDDoc.GetJSObject
oJSO.Collab.showAnnotToolsWhenNoCollab = True
It is working fine till Acrobat 8.0. Now I'm trying with Acrobat 9.0 standard edition, it is throwing scripting error 'An unhandled Win32 exception occured in Acrobat.exe[308].
Can anyone suggest the way to enable 'comment' options in Acrobat Standard 9.0 using Java Script Object?
ThanksI get much the same problem with VB6, Acrobat 9 Pro and WinXP SP3. When I single step the line:
oJSO.Collab.showAnnotToolsWhenNoCollab = True
in debug I go to the error handler for my Sub. Inspecting the VB Err object has Number = -2147417851 and Description = "Automation error
The server threw an exception." I get a Microsoft crash notice about Acrobat a short while later.
I've experimented with the JavaScript debugger in Acrobat and you can execute Collab.showAnnotToolsWhenNoCollab = True and reference the value of Collab.showAnnotToolsWhenNoCollab in the console. The problem appears only when accessing Acrobat Javascript through the Interapplication Communication API.
If anyone can help it would be appreciated. I tried Adobe's Acrobat support and they were no help at all. -
New to Java Script(Want to open a new window using Java Script)
Hi all,
I am new to using Java Script. Now I have a HTML(First.html) page with a ADD button at the end of the page. What I want to know is, if I drag and select some part of the First.html and click on the ADD button a second HTML page(Second.html) should open displaying only the selected contents....
Please help :-(myRef = window.open(self.location,'mywin',
'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); -
How to do Front End Validation for JSP Forms using Java Script with 9iJD...
How to do Front End validation using 9iJD. Any wizard is there. We need to do the val. using Java Script. If its not available, please include that in the Production Release.
Thanks a lot. When is the Production Release is scheduled. Please tell us whether itll be available for Free Download. Bec, we couldnt buy. Bec, if its working fine with all the options without any bug only, we can ask our company to buy 9iJD by stating the advantages. Just explain us.
-
How to run SQL script file on Linux using Java ?
Hi,
I need to execute .sql file using java. I used following approach for this.
private void runScriptEvent(java.awt.event.ActionEvent evt) {
String sqlOutput = "";
String sqlPromptLines="";
String currentFunctionName = "";
if(con!=null){
String userName = jTextField4.getText();
String password = jPasswordField1.getText();
String databaseName = jTextField3.getText();
try {
String script_location = "";
ProcessBuilder processBuilder =null;
Process process = null;
//File file = new File("C:/ScriptFile");
File file = new File("./SQL_Script");
//File file = new File("E:\\install\\SQL_Script");
if(file.exists()){
File [] list_files= file.listFiles(new FileFilter() {
public boolean accept(File f) {
if (f.getName().toLowerCase().endsWith(".sql"))
return true;
return false;
int count = 0;
for (int i = 0; i<list_files.length;i++){
script_location = "@" + list_files.getAbsolutePath();//ORACLE
//currentFunctionName = list_files[i].getName();
StringTokenizer st = new StringTokenizer(list_files[i].getName(), ".");
while(st.hasMoreTokens()) {
currentFunctionName = st.nextToken();
String extention= st.nextToken();
System.out.println("Function Name = "+currentFunctionName + "\t Extention = " + extention);
processBuilder = new ProcessBuilder("sqlplus",userName+"/"+password+"@"+databaseName, script_location); //ORACLE
processBuilder.redirectErrorStream(true);
process = processBuilder.start();
BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
String currentLine = null;
while ((currentLine = in.readLine()) != null) {
sqlPromptLines = " "+sqlPromptLines + currentLine +"\n";
count ++;
System.out.println(count+" " + currentLine);
if(currentLine.equalsIgnoreCase("Function created.")){
sqlOutput = "\n" sqlOutput currentFunctionName + " " currentLine"\n" ;
break;
}// end while
in.close();
process.destroy();
}//end for
}//end if file exists
} catch (IOException e1) {
jTextArea1.setText(e1.getMessage());
System.out.println("Script Done");
jTextArea1.append(sqlOutput);
}// end id Connection is not null
Above code working appropriate on Windows but not on Linux.
is there any changes needed ?
Regards,
Ajay
Edited by: Ajay Sharma on Nov 21, 2012 6:43 PMHi gimbal2,
about code
jTextArea1.setText(e1.getMessage());I am using this code so that the user will be prompted with a message rather than stack trace.
About the issue I am getting on linux i believe its because of following statement.
processBuilder = new ProcessBuilder("sqlplus",userName+"/"+password+"@"+databaseName, script_location); //ORACLERegards,
Ajay
Edited by: Ajay Sharma on Nov 23, 2012 12:05 PM
Edited by: Ajay Sharma on Nov 23, 2012 12:06 PM
Maybe you are looking for
-
How to access database file on CDROM from Java Programe??
Hello friends, I am making online exam application. I want my question database to be reside on CDROM. but i am not getting any idea how to make DSN or static path that resolute the path that i have mentioned for CDROM. basically i want to know how t
-
Hi, I am in ABAP HR. I want to update one existing record for info type 0583. Basically I want to add wage type and amount for an existing employee and new update would be reflected in table PA0583 table. How to make this requirement? Is there any HR
-
Phillips date conversion problems
Hi chaps, I am trying to convert a CHAR7 field from a phillips date, into an Oracle date format. The following expression does not work: SELECT TO_DATE('2006214', 'YYYYWWD') FROM dual (gives error "ORA-01820: format code cannot appear in date input f
-
Swatch Libraries Basic Graphics won't stay on.
I have Illustrator CS5 and I want the Basic Graphics (Dots, Lines, Textures) menu under Patterns in Swatch Libraries to stay on the dock whenever I start Illustrator. I save a new workspace with the libraries attached to the dock on the right hand si
-
Hi guys, I've scanned a couple of documents, set my metadata and now I want to make the document a PDF/A. I go into Preflight, select "Convert to PDF/A-1a (sRGB)" and execute it on my PDFs, but almost all of them fail with errors similar to this: <hi