Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Execute external command - batch file

Former Member
0 Likes
1,883

Hello all,

Well I searched everything here and couldn't find an answer to my problem. I want to execute a java program on the application server. I therefore put the java file on the server and tested it there in the command line. Everything works perfect. I created a batch file and tested it on the server. Everything ok. JAVA_HOME is set correctly on the server, so no trouble there.

Now I want to execute this command from an Abap Program.

What I did:

In SM69 I created a new command:

- operating system command: cmd /c

- parameters: c:\test.bat

Note, when I execute the bat directly on the server, everything works perfectly. But when I test this command with SM69 (or SM49), I always a get "java.lang.NoClassDefFoundError". I tried everything I could think of (set java_home in bat, various directories ...). I then removed the java program from the .bat and put simply "md c:\test" in the .bat. No problem at all.

I tried to test FM SXPG_COMMAND_EXECUTE. There I get a "COMMAND NOT FOUND" error, although it has been correctly defined in SM69 (name and operating system).

I also tried to call the java command directly in SM69 (as a parameter, as a operating command , etc ..). I still get "java.lang.NoClassDefFoundError"

Could somebody help me?

Thank you,

Arlindo

P.S. Contents of .bat:

Just 1 line (URLReader being the program to be called)

java URLReader

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
967

Hello,

Look at the link below

http://java.sun.com/docs/books/tutorial/getStarted/problems/

section "Runtime problems"

Simo

2 REPLIES 2
Read only

Former Member
0 Likes
968

Hello,

Look at the link below

http://java.sun.com/docs/books/tutorial/getStarted/problems/

section "Runtime problems"

Simo

Read only

Former Member
0 Likes
967

Hi Arlindo Valente,

We have few question on SM69.

Requirement:

Using SM69, i need to run a java file.

1) c:\hello.java

2) run SM69

3) we will get the  class file. ( c:\hello.class )

or

run class file

1) c:\hello.class

2) run SM69

Open Issue:

1) Can we directly run the file from SM69 like java compiler.( javac hello.java)

2) Can we run the class file directly.

3) We tried to create a command ztest, OS Windows NT, OS command cmd /c, Parameters for operating system command- we have given the path c:\hello.java

getting error - specify file path not found.

Can you please help us out.

Thanks,

Ravindra