aspose file tools*
The moose likes Beginning Java and the fly likes java and other languages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "java and other languages" Watch "java and other languages" New topic
Author

java and other languages

Bernard Sigmund Gustav
Ranch Hand

Joined: Dec 20, 2005
Posts: 170
hello.

this is my first post here and i hope someone can help me. :-)

anyway, i've just been starting with java and i'd like to know if java can connect to other applications in other languages. like connect to an executable in c to launch it. or something like that? or even connect to something like sas?
Chidanand Chauhan
Ranch Hand

Joined: Nov 10, 2005
Posts: 77
Hi
Yes Offcourse. java has a functinality to connect with other languages.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

And it is called JNI.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Bernard Sigmund Gustav
Ranch Hand

Joined: Dec 20, 2005
Posts: 170
so i can just click a button in my application, both in standalone and web, and it can launch another program?

i'll read the link you gave. thanks a lot.

can you give me an overview though so i would have a basic idea of it?
how can i set that up?
Chidanand Chauhan
Ranch Hand

Joined: Nov 10, 2005
Posts: 77
Originally posted by shuini gustav:
so i can just click a button in my application, both in standalone and web, and it can launch another program?

i'll read the link you gave. thanks a lot.

can you give me an overview though so i would have a basic idea of it?
how can i set that up?


Hi
I think in the above post Paul has given the link that is too much if you are a new in Java.

Cheers
Chidanand Chauhan
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14268
    
  21

Originally posted by shuini gustav:
so i can just click a button in my application, both in standalone and web, and it can launch another program?


If that's the only thing you want to do, you don't need JNI. You can use one of the exec() methods of class java.lang.Runtime to start other programs. Look it up in the API documentation.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


so i can just click a button in my application, both in standalone and web, and it can launch another program?

i'll read the link you gave. thanks a lot.

To call a native method you need JNI. What I mean by the is if you have written a method in C you can't to call through Java, you'll have to use JNI. however, if you have a seperate application you wan't to run from a java process that is easier. You have exec() methods in the java.lang.Runtime class which can execute a seperate process. Doing this from a web application however is probably a bad idea, unless you have a specific need to let clients start processes on your server?
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
What are you trying to do and why? What is your goal? It's not typical for new students of Java to immediately try to get out of Java!


There is no emoticon for what I am feeling!
Bernard Sigmund Gustav
Ranch Hand

Joined: Dec 20, 2005
Posts: 170
i'm trying to make a launcher in java.
but the thing is, the applications that i will be integrating and putting into my launcher are done in c or visual basic.

basically, if the users already have these separate applications installed on their system, then my launcher would just find the exe file and execute it. if the users don't have it installed, then java installs it(applications in vb or c) on their system.

i'll try to look at the java runtime thing. thanks
Stuart Ash
Ranch Hand

Joined: Oct 07, 2005
Posts: 637
There have been others who have tried to write a launcher and have discussed it in other threads earlier at the ranch. You might want to peruse these threads.

You can use the Search feature and dig up these threads.


ASCII silly question, Get a silly ANSI.
 
 
subject: java and other languages