Forums > Java

.jar – and now?

January 22, 2011 | 4:18 pm

aloha,

a collegue made me an application in .jar format.

it is a program which reads files from disks, processes some text
and writes it back to a new location. it has a GUI.

now i would like to use this code with [mxj]. how do i do that?

is there a way how i can use the .jar directly?

or is there a way how i can use the java source files directly?

i have almost no idea about java programming, and i have no idea
of learning the terminology.

(and i will not understand your replies if you start talking java to me.
pls talk in maxmsp to me.)

yet i can read and interpret code unless it is not chinese.

so i have looked into some helpfiles (mxj.gaussian.help) and it looks
like a nobrainer to setup some variables, assign them to inlets,
do a typecheck or set the type in order to send about a dozens
commands i need from a maxmsp patch into the java program
in order to set some variables, give it a read path, and trigger
execution of the process.

in best case i need to run the thing without the OSX JRE app (which is
what mxj gauss does, in opposite to a standalone jar when launched
in OSX of course does not do.)

in case poiting to the .jar or pointing to the source code are solutions
i would be grateful for a little example code.

just say the mxj wouldnt do much more than the [+ ] object.

-110


January 22, 2011 | 5:05 pm

If it’s an applet, you could try loading it in jweb.

It takes very little code if you’re using eclipse (the java IDE). That’s all I really know about. To be honest, I don’t even understand how java compiles or includes jars.

In eclipse, it’s a matter of including your jar(using gui, not code), including Cycling’s api(using a gui), and writing a max object that calls the functions of the objects contained in the jar. (you’ll need documentation from your friend)

in psuedocode it would be something like this

include roman's_friends_jar
include maxmsp_stuff

new MaxObject RomansJarMobj{

   functionA(arguments){
   theResultOfTheJarFunction = romansJar.functionA(Arguments);
   outlet(0,theResultOfTheJarFunction);
   }

}

then in max you would instantiate [MXJ RomansJarMobj]


January 22, 2011 | 5:23 pm

maybe i can not exspect "include my.jar", but it was a try.


January 22, 2011 | 6:17 pm

Hi Roman,

If you can pass arguments to the .jar file to give it the path and name of the file to read, and the path and name to save output to, for example, you could do this from the command-line

from the java man:
java [ options ] -jar file.jar [ argument ... ]

You can use aka.shell, or shell, or the attached mxj object to do this.

best,
Zachary

Attachments:
  1. MXJshellAccess.zip

January 22, 2011 | 6:28 pm

you mean .. and just run the jar app in background? also an idea which i wil note down.


January 22, 2011 | 6:46 pm

Yeah, sort of. If the .jar has a GUI than that will pop up when you run the java -jar in the shell – so not so much in the background. Basically, I’m just saying that you may not need to integrate it into an mxj object, if you don’t want to. But it’s hard to say for sure without knowing more.

best,
Zachary


January 24, 2011 | 5:29 pm

omg.

i just tried to update my netbeans to 6.9 so that i could look at the
code of my friend.

and as it seems 10.4.11 on PPC is the ONLY combination where
there is no java 6 SE available.

it seems it is easier to buy a PC than to bring this dumb app to mxj
on my home and studio macs. :D


Viewing 7 posts - 1 through 7 (of 7 total)