Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java and other languages

 
Bernard Sigmund Gustav
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Yes Offcourse. java has a functinality to connect with other languages.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And it is called JNI.
 
Bernard Sigmund Gustav
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 15438
41
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Bernard Sigmund Gustav
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic