calling java

New to java wiht no directions

Page 1 of 1

14 Replies - 1278 Views - Last Post: 04 October 2008 - 09:58 PM Rate Topic: -----

#1 new_to_java  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 29-September 08

calling java

Post icon  Posted 29 September 2008 - 09:26 PM

Problem is I have a java app I dont create and I have no way to hack it. I know about the methods in that app I need to call to get the job done.

My real problem:

I need run that app. After it starts I need to call a method in that running app. I can use C, Pascal or Bash (I prefer Bash) to talk to that Java app, but I could use Java.

Any help will be apreciated.
Is This A Good Question/Topic? 0
  • +

Replies To: calling java

#2 Locke  Icon User is offline

  • Sarcasm Extraordinaire!
  • member icon

Reputation: 520
  • View blog
  • Posts: 5,596
  • Joined: 20-March 08

Re: calling java

Posted 29 September 2008 - 09:30 PM

So...you just need to run it?
Was This Post Helpful? 0
  • +
  • -

#3 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2650
  • View blog
  • Posts: 11,179
  • Joined: 20-September 08

Re: calling java

Posted 30 September 2008 - 02:13 AM

You need to create an instance of the class in question and call the method if you can
Was This Post Helpful? 0
  • +
  • -

#4 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8324
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: calling java

Posted 30 September 2008 - 02:46 PM

If it is a Java APP it must have a:

public static void main(String[] arg) method into it

at the console prompt:

> java filename

should call this method
Was This Post Helpful? 0
  • +
  • -

#5 new_to_java  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 29-September 08

Re: calling java

Posted 30 September 2008 - 08:27 PM

View Postg00se, on 30 Sep, 2008 - 02:13 AM, said:

You need to create an instance of the class in question and call the method if you can


Sounds greek for me. :blink:

I new to java, I came from procedural languages.

An example could be help.

Thank you to reply.
Was This Post Helpful? 0
  • +
  • -

#6 new_to_java  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 29-September 08

Re: calling java

Posted 30 September 2008 - 08:38 PM

View PostLocke37, on 29 Sep, 2008 - 09:30 PM, said:

So...you just need to run it?


Yes!

I star the app (it is just a jar file) and it stays int the monitor waiting. Next I use a c/pascal/bash/ app/script to call a method with parameters into the running java app. If I succeed the java app window displays the solution. I dont need get a response from the java app. I only need it "listen" my request.

Thank you reply.
Was This Post Helpful? 0
  • +
  • -

#7 new_to_java  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 29-September 08

Re: calling java

Posted 30 September 2008 - 08:45 PM

View Postpbl, on 30 Sep, 2008 - 02:46 PM, said:

If it is a Java APP it must have a:

public static void main(String[] arg) method into it

at the console prompt:

> java filename

should call this method


"> java filename" starts the app. After it started I need to call a method into the running app (it is just a jar file). I know the method and I know the parameters, my problem is send it to the running app.

Thank you reply.
Was This Post Helpful? 0
  • +
  • -

#8 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8324
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: calling java

Posted 30 September 2008 - 08:46 PM

View Postnew_to_java, on 30 Sep, 2008 - 08:38 PM, said:

[I star the app (it is just a jar file) and it stays int the monitor waiting. Next I use a c/pascal/bash/ app/script to call a method with parameters into the running java app. If I succeed the java app window displays the solution. I dont need get a response from the java app. I only need it "listen" my request.

Thank you reply.


So your Java APP will have to listen to a socket or something like that. I don't see a language other than Java calling a Java method. Your are kind of lucky with your problem, 1Lacca (European based) should show up soon in your time zone but personnaly I can't see Pascal calling a Java method. He might have an idea

This post has been edited by pbl: 30 September 2008 - 08:49 PM

Was This Post Helpful? 0
  • +
  • -

#9 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2650
  • View blog
  • Posts: 11,179
  • Joined: 20-September 08

Re: calling java

Posted 01 October 2008 - 12:33 AM

Forget calling Java from elsewhere for the moment: how do you use this Java app normally?
Was This Post Helpful? 0
  • +
  • -

#10 new_to_java  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 29-September 08

Re: calling java

Posted 02 October 2008 - 09:07 PM

View Postg00se, on 1 Oct, 2008 - 12:33 AM, said:

Forget calling Java from elsewhere for the moment: how do you use this Java app normally?


Thank you to all replys.

Well, currently I am using a pure Java implementation of J2ME in J2SE:

http://www.microemu.org/

Great tool.

Problem I need to speed the debug proccess of midlets. Usualy I create the midlet, run the emulator pointing to the midlet and wait it to start. It is simple:

java org.microemu.app.Main (MIDlet application main class)

Works, but it is very time consuming.

I want start the microemulator, let it stay working and command it to call the midlet I want to debug! Call the midlet is just a matter of call a method with parameters.

Microemu listen to sockets, but I have no idea how to send the command to it.

Thank you
Was This Post Helpful? 0
  • +
  • -

#11 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2650
  • View blog
  • Posts: 11,179
  • Joined: 20-September 08

Re: calling java

Posted 03 October 2008 - 12:23 AM

So have you got the source to this emulator?
Was This Post Helpful? 0
  • +
  • -

#12 new_to_java  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 29-September 08

Re: calling java

Posted 03 October 2008 - 09:18 PM

View Postg00se, on 3 Oct, 2008 - 12:23 AM, said:

So have you got the source to this emulator?


Yes, it is OpenSource. But I dont know java sufficiently well to hack it. I prefer a less invasise way to get the job done. :blink:

Thank you
Was This Post Helpful? 0
  • +
  • -

#13 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2650
  • View blog
  • Posts: 11,179
  • Joined: 20-September 08

Re: calling java

Posted 04 October 2008 - 05:41 AM

Well, unless it's extremely well documented, you're going to have to look into the source to help you.

If you want to call it from another language, let's say Pascal for the sake of argument, you'll need to create a VM in Pascal then invoke the appropriate method on the emulator
Was This Post Helpful? 0
  • +
  • -

#14 new_to_java  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 29-September 08

Re: calling java

Posted 04 October 2008 - 09:50 PM

View Postpbl, on 30 Sep, 2008 - 08:46 PM, said:

View Postnew_to_java, on 30 Sep, 2008 - 08:38 PM, said:

[I star the app (it is just a jar file) and it stays int the monitor waiting. Next I use a c/pascal/bash/ app/script to call a method with parameters into the running java app. If I succeed the java app window displays the solution. I dont need get a response from the java app. I only need it "listen" my request.

Thank you reply.


So your Java APP will have to listen to a socket or something like that. I don't see a language other than Java calling a Java method. Your are kind of lucky with your problem, 1Lacca (European based) should show up soon in your time zone but personnaly I can't see Pascal calling a Java method. He might have an idea


So use java is my last resource. Could you please show me an example java code where a running java app/class start other java class/app and call a methods on my command into it?

Thank you
Was This Post Helpful? 0
  • +
  • -

#15 new_to_java  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 29-September 08

Re: calling java

Posted 04 October 2008 - 09:58 PM

View Postg00se, on 4 Oct, 2008 - 05:41 AM, said:

Well, unless it's extremely well documented, you're going to have to look into the source to help you.

If you want to call it from another language, let's say Pascal for the sake of argument, you'll need to create a VM in Pascal then invoke the appropriate method on the emulator


I know how to connect and interact to C/Pascal apps from other C/pascal apps, but I dont know how to connect to a java app using C/Pascal.

Looks like use a java application is my last resource. Like I wrote in an other reply I am considering use java. Could you show me a java code example on start a java application from other java application and talk to it (call a method) no stopping?

Thank you
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1