Execute Java Code on client
Hello,
how can i execute java code on clientside?
I guess you will have to add an applet to the web page.
http://developers.sun.com/prodtech/javatools/jscreator/reference/techart/2/applet.html
Similar Messages
-
Java.lang.NoClassDefFoundError when executing JAVA code
Hy everyone,
Trying to execute some java code through forms I got this error when running my program : java.lang.NoClassDefFoundError : simple (where simple is a java class I developped).
These are the steps I followed:
1- Devopping a simple JAVA class (simple.java) and compiling in JDK 1.4 (for compatibilty with forms 10.1.2.0.2)
2- Creating the JAR file
3- Copying the JAR file in <ORACLE_HOME>\forms\java
4- Adding the adress of the JAR file in CLASSPATH (environment variable of the server)
5- Adding the adress of the JAR file in CLASSPATH (environmental file of OAS default.env)
6- Importing the JAVA class trought forms builder (program>>import java class)
7- Invoking the JAVA class via the PL/SQL packages created by forms builder
8- Running the program
Thanks for your help.
Regards.In most cases, you should not have to stop and restart OC4J_BI_FORMS to pick such changes. However, since you are having problems, I would ensure that all frmweb processes have been stopped, then stop and restart OC4J_BI_FORMS and retest. If that doesn't work, you should review how you imported the java into your app. Look closely at the Importer options you used and ensure that you have not change the file name at any point. Because you are working with Java, case sensitivity is critical.
Also, where are you seeing the error message? Client java console or in a server side log? If server side, exactly which log file is reporting the problem? I would suggest you post the first 4 ro 5 lines of the error and not just the NoClassDefFound part. -
Using a button of type=button to execute java code
Hello,
I here what I need to do.
- A user fill a form
- He press submit
- the button goes and execute some java code and then refresh the page (same page)
Now I don't want to use a input=Submit, that call a a servlet that just update the information, and output to the servlet;
out.println("<html>");
out.println("<body>");
out.println("<head>");
out.println("<meta content=\"1; url=" + "SamePage.jsp" + "\" http-equiv=refresh>");
out.println("</head>");
out.println("</body>");
out.println("</html>");Instead, I would like to do: <INPUT TYPE="button" VALUE="Close Window" onClick="window.close();"> but instead of JavaScript in the onClick it would be JavaCode that would update the object (already instantiated in the JSP) and would then refresh the page.
Is this possible?
thanks.Hi,
it is not possible because JSP code is executed server-side, while javascript code is executed client-side (in client's browser). -
Executing Java Code in ODI Procedure
Hi All,
I have following java code which i need to write on ODI procedure but i am not sure which technology to chose (Jython,Sunopsis API or Java BeanShell).
I tried to execute the procedure Jyhton with <% "Java code"%> but getting the error.Any boddy can suggest where i doing wrong.
<%
import javax.naming.Context;
import javax.naming.NamingEnumeration;
import javax.naming.directory.*;
import java.util.Hashtable;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
String userName = "HXXXXXX";
String CN1=null;
String Dis_Name=null;
String Mem_of=null;
String Mail=null;
String SGID=null;
File file = new File("C:/Project/ODI/LDAPID.txt");
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "LDAP://XX.if.YYYY.net:389/OU=XYZ,DC=ZZ,DC=if,DC=XYZ,DC=COM");
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, new String("" + "\\" + userName));
env.put(Context.SECURITY_CREDENTIALS, "");
DirContext ctx = null;
NamingEnumeration results = null;
ctx = new InitialDirContext(env);
SearchControls controls = new SearchControls();
controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
results = ctx.search("", "(objectclass=person)", controls);
FileWriter fw = new FileWriter(file.getAbsoluteFile());
BufferedWriter bw = new BufferedWriter(fw);
while (results.hasMore())
SearchResult searchResult = (SearchResult) results.next();
Attributes attributes = searchResult.getAttributes();
Attribute attr = attributes.get("cn");
String cn = (String) attr.get();
CN1=(String.valueOf(attributes.get("cn")));
Dis_Name=(String.valueOf(attributes.get("displayName")));
SGID=(String.valueOf(attributes.get("userPrincipalName")));
Mem_of=(String.valueOf(attributes.get("memberOf")));
Mail=(String.valueOf(attributes.get("mail")));
bw.write(CN1 + " || " + Dis_Name + " || " + SGID + " || " + Mail);
bw.newLine();
bw.close();
results.close();
ctx.close();
%>
I am getting following error.
The application script threw an exception: java.lang.NullPointerException BSF info: CODE_JAVA at line: 0 column: columnNo
Please suggest what went wrong with the code.
Thanks
RegardsIn Jython you don not need to declare the type so String userName = "HXXXXXX"; should simply read userName = "HXXXXXX" . Lots of your code need to be rewritten to work with Jython if you choose that as your technology.
-
Execute java code taken from a properties file
I have a requirement to store some java code in the Properties file & use the code inside the program later. Is there a way I can execute this code after I get it from the .properties file which is retrieved using the ResourceBundle?
Example:
File: system.properties
Item_list=blocksBean.menu(QueryValue,request.getContextPath())
Inside my Java program I'm using this..
theBody=codesBean.replaceAll(theBody, "%%menu%%",ResourceBundle.getBundle("system").getString("Item_list"), true);
instead of
theBody=codesBean.replaceAll(theBody, "%%menu%%",blocksBean.menu(QueryValue,request.getContextPath()), true);
This doesn't work because ResourceBundle.getBundle("... returns the value.. which is a string "blocksBean.menu(QueryValue,request.getContextPath())". But what I need is it has to be executed..
blocksBean.menu() returns a string value of html code fetched from the dartabase.
Is there a way I can execute blocksBean.menu() which is retrieved from the .properties file.. If anyone has done it / have an idea on this.. please e-mail me [email protected]
I need something like an eval() in javaScript..
Thanks in advance
-ashokThese boys might have something that will help you:
http://www.beanshell.org/
Good luck
Lee -
Execute java code before rendering the page
Hi,
In a task flow, can I execute some java code before the page/view is rendered (i.e. some preprocessing). I would need to be able to have access to the bindings on the page.
Thanks!Can you try doing as specified below:
If it is simple JSPX, you could use the phase listener as follows:
JSPX Code:
<f:view beforePhase="#{SamplePageBean.phaseListener}">
<af:document id="d1">
<af:form id="f1">
<af:panelFormLayout id="pfl1">
<f:facet name="footer"/>
</af:panelFormLayout>
</af:form>
</af:document>
</f:view>
Bean Code:
public class SamplePageBean {
public SamplePageBean() {
public void phaseListener(PhaseEvent phaseEvent) {
if (phaseEvent.getPhaseId().equals(phaseEvent.getPhaseId().RENDER_RESPONSE)) {
// DO NECESSARY INITIALIZATION
Thanks,
Navaneeth -
Hi experts,
I'd like to execute some Java code after a successful login. I guess I could write a custom login module or use a WD Java iView to do this but a "better" solution may exist.
Regards,
PierreCustomizing your login module is probably your best bet. As soon as you're user is authenticated, you can execute your custom Java code.
From my experience, I have not seen an easier / cleaner way to capture that event.
Regards,
Tom -
Convert strings to executable java code
Hey,
I'm not sure how easy or hard this is to accomplish, but I am looking for a way to take a string from a JTextField and use it as a control structure for an IF block.
For example, the user inputs 'keyword=="test" || keyword=="test2"' I want to use it in an if block to control it.
Is there a way to do this? I realize the java file is already compiled in a class, so the string would probably be incapable of doing such a thing.
Any thoughts would be appreciated!Basically this is impossible, because Java is a compiled language, but there are ways around it.
Actually the ways are all basically one way: use an interpreted language. You can embed one into Java. You can write your own, new language (it could be a small simple mini-language, for example one that only evaluates boolean expressions; this is easier than it sounds), or you can use one that already exists.
There already is an interpreted language for Java. It's called BeanShell. Also I'm told that someone has written a javascript interpreter for Java, but I don't know the details.
I'd suggest Googling for BeanShell. It sounds like the quickest, easiest solution.
But be careful: letting users execute arbitrary code can be a huge security hole. -
Class compiling/executing JAVA-Code??
Hi!
Stupid question: ;-)
Is there a possibility to "parse" Java-Code into a JAVA-Class or to give JAVA-Code to a class that compiles the code and execute it?
Thanks for answering!
Mark Hauchwitz.background: we're running servlets and simply need to "parse" specialized/customized java-code for every customer into the servlet code. Source: database or whatever...
How to get started? -
Batch file to execute java code
Hi,
I need to write a batch file to execute a sequence of java applications.
The problem i face is in addition to the usual libraries I am also using certain jar files i downloaded like the mail interface etc.
When i just compile a java code using a simple batch file giving the path of the compiler and the java code, it fails citing not knowing the location if the packages.
could anyone please let me know what i need to do. Is there like a skeleton that i might find somewhere for this operationdexterity wrote:
Hi,
I need to write a batch file to execute a sequence of java applications.
The problem i face is in addition to the usual libraries I am also using certain jar files i downloaded like the mail interface etc.
When i just compile a java code using a simple batch file giving the path of the compiler and the java code, it fails citing not knowing the location if the packages.
could anyone please let me know what i need to do. Is there like a skeleton that i might find somewhere for this operationSet the classpath correctly at runtime.
Why do you need the location of your compiler? Are you compiling or running? If you are compiling go look at Ant. -
Error when executing Java code, java.lang.NoClassFoundError:
Hi, I am new learner in Java Programming and I am using J2SDK and notepad to write a code. I don't have problem in compiling using javac filename, however I received an error when executing using java filename.
The error message I got is Exception in thread "main" java.lang.NoClassDefFoundError: Hello/jawa.
I have verified this simple code - Hello has no issue but somehow it does not run. I even try to compile and execute in other computer also the similiar error returned.
My Client Platform is Windows XP Professional.
I would appreciate any expert can help to suggest me the knowledge/solution to fix this kind of error. Thanks
JackieIt looks like you entered the command "java Hello.java" or "java Hello/java" (I assumed 'jawa' was a typo.)
You should have entered "java Hello" if your class name is Hello. I am guessing that Hello.java is probably the source code file name. The argument to the java command is the fully qualified class name. "java Hello.java" tells the java command to look for a class named java that is in the Hello package. -
How to: Transform Activity: Read global/local variable, execute java code
Could anyone please show me how to do that???
could you please elaborate your usecase? yes you can read global variable using getVariableData( ) xpath function and pass them as an argument to the processXSLT ( ) xpath function.
You can read the global or local variables inside java exec using, please refer samples/references/javaexec sample. -
How to execute a custom java code from the process
Hi All,
I'm writing a process to generate the PDF and it works fine. Now, at the end or in the middle of the process, i would like to execute/write a java code then it will be invoked when the process running. Assume not using web service, is there another way? samples how to write custom code?
Thanks,The Execute Script service allows you to execute java code on a particular step.
A more robust solution would be to create a custom component for your custom code.
Jasmin -
Error while executing java stored procedure from a pl/sql procedure
We have a requirement where we need to execute JAVA code stored in an Oracle database (Java Stored Procedure). This code uses some JAR files which we have already loaded without any errors in the database.
The class file was also loaded in the database without any errors. But when we execute the method of this class (JAVA code), it gives the following error:
ORA-29532: Java call terminated by uncaught Java exception:
java.lang.NoClassDefFoundError
Is there any way of debugging the code and getting to know where exactly the problem is? Or, any tool/software available for doing the same.
Any pointers would be of great help!
Thanks in advanceHi Uday,
My guess is that there is a problem with your java stored procedure that is causing the "ExceptionInInitializer" error to be thrown. According to the javadoc:
is thrown to indicate that an exception occurred during
evaluation of a static initializer or
the initializer for a static variable
Since I didn't see any of your code in your post, I can't help you much more, I'm afraid. Perhaps if you would provide some more details, I may be able to help you some more. I think the following details would be helpful:
1. Complete error message and stack trace you are getting.
2. The section of your java code that you think is causing the problem.
3. Oracle database version you are using.
Good Luck,
Avi. -
Java run time error while executing JavaFX code
Hi
I copied the code from [http://java.sun.com/javafx/1/tutorials/ui/overview/UIControls.fx|http://java.sun.com/javafx/1/tutorials/ui/overview/UIControls.fx] while
reading in [http://java.sun.com/javafx/1/tutorials/ui/overview/#controls|http://java.sun.com/javafx/1/tutorials/ui/overview/#controls] tutorial and paste it to my
netbeans editor but i got following error.
init:
deps-jar:
compile:
jar:
standard-run:
# An unexpected error has been detected by Java Runtime Environment:
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d94513f, pid=5152, tid=5996
# Java VM: Java HotSpot(TM) Client VM (1.6.0_03-b05 mixed mode, sharing)
# Problematic frame:
# V [jvm.dll+0xd513f]
# An error report file with more information is saved as hs_err_pid5152.log
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
BUILD FAILED (total time: 18 seconds)can anyone tell whether its netbeans fault or javaFX. I am using netbeans 6.5.1 on windows vista. I have added following plugin in netbeans for javaFX
*JavaFX Kit
*JavaFX SDK for Windows
is anyone also getting this error for this code and have solution for this.You are correct the crash is causing due to ToggleButton and ProgessBar. the code is correct because i tried it on eclipse 3.4 and it worked fine.This is definitely netbeans error. because its giving error even if u try to execute javafx code with just one ToggleButton or ProgressBar. I tried the following simple code in netbeans 6.5
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.control.ToggleButton;
import javafx.scene.control.ProgressBar;
var toggle=ToggleButton {
translateX:50
translateY:50
text: "First"
width:100
height:20
var progress= ProgressBar {
progress: bind ProgressBar.computeProgress( 100, 30 )
Stage {
title : "Toggle Button Test"
scene: Scene {
width: 200
height: 200
content: [ toggle
} When i just added toggle button to contents then button showed up in window but on clicking it window disappear and compiler gave crash error on the other hand when i added just progess bar it just throws the error.The same code is running fine on eclipse
Is there any workaround in netbeans for this if its a bug and if not what should i do to correct it.
Maybe you are looking for
-
How to send PR & PO data for materials through IDOC in XML
Hi Experts, I am looking for a solution to send open PR & open PO related data for diffrent materials through as IDCO in XML file. Scenario is i have to show a report in a 3rd party system for open PR & open PR that too will come after selection some
-
Is there a way to check when was my phone last used?
My apologies for the very unusual question. My question is simply to know if there is a way to find out when was my phone last tuned on or used. Basically i left my business at a place with a lot sensitive work data and i have a great feeling that it
-
When I send a text to my wife i get her reply under another name. How do I fix this?
Since I got my iPhone 4S when I text my wife her replies come under my old hotmail address name. Very strange indeed. I have tried deleting her as a contact and then renaming her but still the same. The old hotmail address isn't even listed as one of
-
Using Javascript to hide objects that have no "binding" tab?
Hello, I'm attempting to create a form that uses checkboxes to hide a variety of fields. I've run into a problem though; it seems that only text fields have a binding tab (unless I'm missing something). Is there a way for me to do show hides for ima
-
Not exactly PP, but relevant for troubleshooting crashes. PSU woes.
This is not directly related to PP, but the following may help you if you encounter inexplicable hangs or crashes while editing. On an older system I had the following symptom: While editing I would get sudden MFT warnings, system freezes, no more mo