Execute MSIL code using JAVA
How can I execute MSIL code using java?
Thanks for your reply. I did it in google and didn't find any useful think.
I just want to know is there any technique in java or already written product that can do that.
Any advice will be helpful. Thanks
Similar Messages
-
Invoke exe through java code(using java.lang.Runtime)
Iam trying to invoke an exe from java code.If i give the complete path for that exe it is running fine .But if i set the environment variable and directly execute the exe through command prompt it iss running fine , but it fails to run when i do the same using java code i.e. java.lang.Runtime.exec function
Give "//" for directory seperator.
E.g. r.exec("c://test//test.exe",null);
Why? That doesn't look correct.It is correct. It will work fine. Try it out.But it doesn't add or solve anything. A forward slash
does not need to be escaped.'
It's not even escaping. It's just doubling up. If that works, I'd bet "C://///test///////test.exe" does also. -
Hello,
We r confirmed that to execute SQL Loader,
One need to write an External Routine.
So First Step itself need to create a
'C' file which executes our sql Loader or
Using Java.
How Can I execute the SQL Loader (.exe)
using Java?
How can I proceed? Waiting ASAP. Thankyou
Abhay
nullI have a nice piece of Java code that allows you to execute OS commands from within a PL/SQL block in Oracle. If you need the code send me an email. I know it works in Unix and it should work on most platforms.
-
Executing Jar Application using Java Programs
Hello there,
How can I run a java application using java programs.
Desc:
public class someapp {
public static void main(String[] ext) {
// How can I execute a jar application from here through java code
}You could use java.lang.Runtime.exec(). Another way could be loading the main class of the jar file and invoking its main method dynamically.
-
How to execute ".exe" files using java
Hi,
This is guruvulu,
I have a problem in executing ".exe" files.For Example InternetExplorer.Hi,
You can execute .exe files in JAVA using the following code.
Runtime rt1 = Runtime.getRuntime();
Process pc = rt1.exec("someexe.exe");
you can get the output of the executed exe file in
in = pc.getInputStream(); //this returns a InputStream
hope this solves your problem.
regards,
P.Venkat -
Execute unix command using java
Hello
Can we execute a unix command using java? If it is how we can execute. Is this affect the performance of the program.
ThanksI tried what you said. But its not working and returning error message,
java.io.IOException: CreateProcess: ls -a error=2
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
If i try this statement,
Runtime.getRuntime().exec("c\windows\notepad");
It is working fine.
Any idea about this.
Plz ........... -
Login codes using java database (validates with Microsoft Access File)
hi all pro-programmer, can you show me the code to login with the username and password using java database. When the user enters the username and password in the login page then it will go to the requested page. may i know how to do it?
no one will give you complete code.
i'll lay out the pieces for you, though:
(1) start with a User object. give it username and password attributes.
(2) write a UserDAO interface with CRUD operations for a User object.
(3) write a UserDAOImpl for your Microsoft Access database
(4) write an AuthenticationService interface
(5) write an implementation of the AuthenicationService that works with the UserDAO to authorize a User.
Use a servlet to accept request from your login page and pass it off to the service. Voila.
PS - Here's skeleton to start with. UI, servlet, and controller are your responsibility:
package model;
public class User implements Serializable
private String username;
private String password;
public User(String u, String p)
this.username = u;
this.password = p;
public String getUsername() { return username; }
public String getPassword() { return password; }
public interface UserDAO
public User findByUsername(String username);
public void saveOrUpdate(User user);
public void delete(User user);
public class UserDAOImpl implements UserDAO
private Connection connection;
public UserDAOImpl(Connection connection)
this.connection = connection;
public User findByUsername(String username)
String password = "";
// logic for querying the database for a User
return new User(username, password);
public void saveOrUpdate(User user)
// save or update a User
public void delete(User user)
// delete a User
public interface AuthenticationService
public boolean isAuthorized(String username);
public class AuthenticationServiceImpl implements AuthenticationService
private UserDAO userDAO;
public AuthenticationServiceImpl()
// Create a database connection here and the UserDAO, too.
public boolean isAuthorized(String username)
boolean isAuthorized = false;
// Add logic to do the database query and decide if the username is authorized
return isAuthorized;
} -
Execute dll function using Java Technology
Can I use Java to execute an existing dll function? Currently this dll function is sits in Unix and was compiled using Borland C compiler. How can this to be done?
If you know all the entry ponts to the dll, and their parameters, return values and caling conventions then you should be able to write 'c' funtion prototype for them like this
stdcall int somefunc(int x, char *x);
If so, you can load the dll (on windows) with LoadModule
get each functions address with GetProcAddress
and cast the result to a pointer to the appropriate prototype
THEN you can write a JNI wrapper dll that makes these functions available from JAVA -
Making Executable Jar file using java Application
Following Program creates the jar file at specified location. but, I wonder why this file does not execute on double clicking on it, in spite of that the Manifest file contain correct main class file name
//MakJar.java
import java.io.*;
public class MakJar
public static void main(String[] args)throws IOException{
Process p;
String str="D:\\Himesh\\JFiles";
try {
BufferedWriter out = new BufferedWriter(new FileWriter(str+"\\mainClass.txt"));
out.write("Main-Class: TestFrame\n");
out.close();
} catch (IOException e) {
try
p=Runtime.getRuntime().exec("cmd /c D:\\Java6\\jdk1.6.0\\bin\\javac.exe "+str+"\\TestFrame.java");
p=Runtime.getRuntime().exec("cmd /c D:\\Java6\\jdk1.6.0\\bin\\jar cvmf "+str+"\\mainClass.txt "+str+"\\Demo.jar "+str+"\\*.class");
catch(IOException e)
System.err.println("Error on exec() method");
e.printStackTrace();
}Sir,
On execute the jar using a "java -jar. . ." command. it gives the error--
"Exception in thread "main" java.lang.NoClassDefFoundError : TestFrame"
On Extracting the files from jar file made by the java program,i found that the manifist file ( containing the name of main class) and t the class file are included in the jar file.
But if I make the jar file manually it works perfectly.I have even reinstalled the java but the problem persists
Same thing happen if i use MS-DOS batch file.
??????If i put the batch file in the same directory and execute it The resulting jar file works,But
??????if the batch file is executed from outside the directory The resulting jar file fails execute.
what should i do??? -
Re: Executing Planning Sequence using java script.
Hi All,
Can anyone tell me how to execute a planning sequence using a java script.
Regards.
Shafi.Hi Deepti,
i have written a java script which will display the error message from IP in a Pop up window.
For this to work the java script function needs to be called once the planning sequence is done with execution.
I didn't find ways to do it based on the WAD commands.
hence i thought i can run the planning sequence in the same java script that i have written.
Can you help me based on the inpus ihave given ?
Regards.
Shafi. -
Changing java code using Java program
hi All,
I have some java classes, which i need to modify. The changes are mechanical, like putting finally block for the methods where there is a try block.
Please suggest on how to write a small java program that will accomplish the task. Some code snippets may be helpful.
Thanks,
Raj.no, you got me wrong. After i add the finally blocks,
i will perform the clean up tasks there. The first
part of adding the finally blocks,i want to perform
using a program.No you really don't want to do this.
a) This will not be easy and in fact will be quite messy.
b) It doesn't gain you anything anyway. As you yourself just noted you will have to put appropriate code in all those blocks anyway.
So give this up and do it manually and for next time you will have learned that you should follow the standards from your project from the start. -
How to check special characters in java code using Java.util.regex package
String guid="first_Name;Last_Name";
Pattern p5 = Pattern.compile("\\p{Punct}");
Matcher m5 =p5.matcher(guid);
boolean test=m5.matches();
I want to find out the weather any speacial characters are there in the String guid using regex.
but above code is always returning false. pls suggest.Pattern.compile ("[^\\w]");The above will match any non [a-zA-Z0-9_] character.
Or you could do
Pattern.compile("[^\\s^\\w]");This should match anything that is not a valid charcter and is not whitespace. -
Error while Shell executing from Oracle Using java proc
Hi All,
After a long time I'm here again.
I'm facing one strange problem.
SQL>
SQL> select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
Elapsed: 00:00:00.01
SQL>
SQL>And, the purpose of this procedure is to execute shell command from PL/SQL application.
It seems that this procedure is able to execute shell commands like *'pwd'*.
But, when it comes to other commands like *'ls -lrt'* or *'sqlldr'* it throws error.
Kindly find the following details -
SQL> declare
2 err_cd number;
3 err_desc varchar2(500);
4 begin
5 dbms_java.set_output(1000000);
6 host(p_command => '/a/mis/Sqlloader_script/loader_command/ST_det.sh');
7 dbms_output.put_line('Successfully Executed SQL Loader Command');
8 exception
9 when others then
10 err_cd := 1;
11 err_desc := substr(sqlerrm,1,500);
12 dbms_output.put_line(err_desc);
13 end;
14 /
Process err :/a/mis/Sqlloader_script/loader_command/ST_det.sh: line 19: sqlldr: No such file or directory
Successfully Executed SQL Loader Command
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.11
SQL>
SQL> declare
2 err_cd number;
3 err_desc varchar2(500);
4 begin
5 dbms_java.set_output(1000000);
6 host(p_command => 'pwd');
7 dbms_output.put_line('Successfully Executed SQL Loader Command');
8 exception
9 when others then
10 err_cd := 1;
11 err_desc := substr(sqlerrm,1,500);
12 dbms_output.put_line(err_desc);
13 end;
14 /
Process out :/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs
Successfully Executed SQL Loader Command
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.11
SQL>But, the file exists in the following path -
SQL> !ls -lrt /a/mis/Sqlloader_script/loader_command/ST_det.sh
-rwxrwxr-x 1 oracle root 1315 Apr 13 13:40 /a/mis/Sqlloader_script/loader_command/ST_det.shAny idea?
Where is the privileges that i need to give to the current user?
When i directly execute the Sql Loader from the oracle o/s - it ran successfully.
[oracle@pult loader_command]$ /a/mis/Sqlloader_script/loader_command/ST_det.sh
SQL*Loader: Release 11.2.0.1.0 - Production on Fri Apr 13 14:59:19 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Commit point reached - logical record count 64
Commit point reached - logical record count 128
Commit point reached - logical record count 192
Commit point reached - logical record count 256
Commit point reached - logical record count 320
Commit point reached - logical record count 384
Commit point reached - logical record count 448
Commit point reached - logical record count 512
Commit point reached - logical record count 576
Commit point reached - logical record count 640
Commit point reached - logical record count 704
Commit point reached - logical record count 732
Succesful execution of Loading.
[oracle@pult loader_command]$
[oracle@pult loader_command]$Thanks in advance.This is a generic java proc.
It works well with windows.
But, facing this problem in Linux.
Procedure looks like -
create or replace and compile java source named host as
import java.io.*;
public class Host {
public static void executeCommand(String command) {
try {
String[] finalCommand;
if (isWindows()) {
finalCommand = new String[4];
finalCommand[0] = "C:\\windows\\system32\\cmd.exe"; // Windows XP/2003
finalCommand[1] = "/y";
finalCommand[2] = "/c";
finalCommand[3] = command;
else {
finalCommand = new String[3];
finalCommand[0] = "/bin/bash";
finalCommand[1] = "-c";
finalCommand[2] = command;
final Process pr = Runtime.getRuntime().exec(finalCommand);
pr.waitFor();
new Thread(new Runnable(){
public void run() {
BufferedReader br_in = null;
try {
br_in = new BufferedReader(new InputStreamReader(pr.getInputStream()));
String buff = null;
while ((buff = br_in.readLine()) != null) {
System.out.println("Process out :" + buff);
try {Thread.sleep(100); } catch(Exception e) {}
br_in.close();
catch (IOException ioe) {
System.out.println("Failed to print.");
ioe.printStackTrace();
finally {
try {
br_in.close();
} catch (Exception ex) {}
}).start();
new Thread(new Runnable(){
public void run() {
BufferedReader br_err = null;
try {
br_err = new BufferedReader(new InputStreamReader(pr.getErrorStream()));
String buff = null;
while ((buff = br_err.readLine()) != null) {
System.out.println("Process err :" + buff);
try {Thread.sleep(100); } catch(Exception e) {}
br_err.close();
catch (IOException ioe) {
System.out.println("Process error.");
ioe.printStackTrace();
finally {
try {
br_err.close();
} catch (Exception ex) {}
}).start();
catch (Exception ex) {
System.out.println(ex.getLocalizedMessage());
public static boolean isWindows() {
if (System.getProperty("os.name").toLowerCase().indexOf("windows") != -1)
return true;
else
return false;
};Looking for your reply. -
Execute perl-script using java
Hi All
I would like to execute a perl script (inside a java app) and retrieve its output. This java program needs this output.
Can someone give me information on how to do this ?
Thanks a lot in advance
LucaOk, solved it:
import java.lang.Runtime ;
import java.io.* ;
public class Test {
public static void main ( String ARGV[] ) {
Runtime r = Runtime.getRuntime() ;
Process p = null ;
DataInputStream dis = null ;
String s ;
try {
String cmd[] = new String[1] ;
cmd[0] = "./a.pl" ;
p = r.exec(cmd) ;
dis = new DataInputStream(p.getInputStream()); // create file I/O
s = dis.readLine();
System.out.println("|"+s+"|") ;
s = dis.readLine();
System.out.println("|"+s+"|") ;
catch(IOException e) {}
} -
How to read and then extract HTMl source code using java program?
Hi,
Could someone tell me how to read and then extract the content of certain tag from html source code. For example, given url http://.... , I would like to know what the <Title> content <Title> in that page is.
Any help is greatly appreciate.Use a URLConnection to make the connection to the page at the needed URL. From the URLConnection, you can get an InputStream that is the stream of data from that page. Just search through the stream and find the <title> tags (don't forget to check for case sensitivity).
Maybe you are looking for
-
Error while deleting any component from the widget
Whenever i delete any component from widget it stops running..i means whenever after deleting i execte the widget nothing happens.........it gives me an error saying "Syntax Error in line 1 " and no other information....so can anyone tell me how to r
-
I can no longer create a new folder on my desktop
Both my boyfriend and I have searched ad nauseum and cannot find out why I can no longer create a new folder on my desktop. When we try, we get an error message that says "the operation can't be completed because you don't have the necessary permissi
-
If your P.C. does not reconize your ipod video read this !!!
Scroll down to see solution My story:I just got a new ipod video 60 gb a few days ago. i installed everything and it was up to date. I have a pc with windows xp home edition. when i pluged it in all it did was make a sound like it reconized it. I spe
-
Hello, we just upgraded to NW EHP2. After this, our WebDynpro Application create an dump "CX_WDR_ADAPTER_EXCEPTION", if we call an Pop-up ( it's just an View with an IFRAME-Element ). If i delete the Iframe, the Pop-up is called correctly. I know tha
-
I know I just started using Aperture, but my question shouldn't be this difficult. If I process a photo in Aperture (use Noise Reduction as an example), it gets saved and I only see one version of the picture in my Library (the processed version)...