Adding external files to my project and calling them?

Hi guys!
So, what i’m working on might not even be possible, but i’m hoping it is. I’ve got a few java files that I really want to add to my xojo project. I’ve tried to import them by dragging them into the interactive shell, but all it does is puts a named alias styled file in the shell, and leaves me with a few questions…
When compiled, does this file get included in its full glory into the xojo program? (i’m hoping so!)
How can I go about targeting this file? I can’t seem to even get the absolute path from it!

I’ve tried a few things, but haven’t had much luck getting anything to work. Again, I know this might not be possible to begin with, but i’m hoping. I really want to keep the java components incorporated into the program.

things dragged into the project like this behave like constants
thats probably not going to behave the way you want
you’d have to write that out to a file on disk then use a shell or something like that to run it (and hope that the JRE is installed etc)

Okay, that’s… somewhat cool! i didn’t realize they behaved like constants. i’m guessing a simple outputstream would be best for dumping them into the hard-drive. Still, mildly disappointing, i was hoping I could keep the java script away from prying eyes.

I know it’s possible on the mac to just drop it into the contents of the .app, and I have a class file to access it, so on a mac, it’s totally do-able, even without tossing it in the application, just not sure how to pull it off inside windows.

… so, to sum up, what im wanting to do is impossible, right? just wanting to know for sure.

the other alternative is to use a copy file step
this eaves them as external resources that you can call via a shell or whatever without having t writ them out
there’s more than one way of getting there from here :slight_smile:

not impossible to make it so you can use them
BUT you can’t just drag them into the project & have them be executable

the constant route makes it so they are not just laying around on disk where eye can see them
so that might work best
if its java SOMEHOW it has to get from the app you built into the java run time
And there are means to make that relatively hidden from via - or I think MBS has a plugin that might let you run java from a “string” inside an app

I’m sorry for sounding clueless, but copy file step?

Based on your last reply about wanting to keep things sort of hidden I would juts pull them into the project then figure out how to run those dirtily without having to write them to disk if you can so prying eyes won’t see them

I have absolutely no knowledge of Java, so it may be impossible. But what about placing the file as invisible in a somewhat cryptic folder deep inside the file system when needed, and delete it immediately after usage ?

That doesn’t protect it from prying eyes. In that respect, the Windows version is more secure. Look into MBS for a way to execute java.

Actually, there may be an excellent way to use the MBS Java Classes Monkeybread Xojo plugin - The plugin MBS Java Plugin and protect the script from being seen. VirtualVolume is perfect to use an invisible disk http://documentation.xojo.com/index.php/VirtualVolume

Son of a… How did I forget virtual volumes!?! /facepalm. Well, your right about mac not being able to protect it, but on that one i kinda just wanted the java file to be inside the app. One of those if they don’t know about doing it that way, they woln’t look things.

Will look into the MBS classes, but if I could accomplish this without using additional modules, etc, i’d really rather do that.

[quote=119572:@David Coffey]Son of a… How did I forget virtual volumes!?! /facepalm. Well, your right about mac not being able to protect it, but on that one i kinda just wanted the java file to be inside the app. One of those if they don’t know about doing it that way, they woln’t look things.

Will look into the MBS classes, but if I could accomplish this without using additional modules, etc, i’d really rather do that.[/quote]

I believe a VirtualVolume is only available within a Xojo app. So the MBS classes seem the only solution.

The disk option is not out, though. If you save your file with a preceding dot, it is invisible.
On Mac at least it is possible to address an invisible file so you could very well do it that way :

java .HelloWorld

There must be ways to hide files in Windows just the same ; I do not know if they can be executed via shell, though. But it is possible you could place them in an invisible folder and still shell to it.

I would not waste resources on running java to decrypt something.
Xojo has built in encryption for data and so you can write yourself an app to encrypt a file, drop it in the IDE and later decrypt it.

I’m sorry, Christian, i’m not sure what was said to give you the idea that i’m using java to encrypt or decrypt something. Maybe this explanation will help more with why and what i’m trying to do:

I started a few years back trying to write this program, and to do what I wanted it to do, I needed to visually capture and compare elements of a picture to elements of a desktop screen, or program. Now, I did manage to get it running via Xojo (before the namechange that is…) up until the mac os depreciated a function that made it possible. I walked away from the project for a while, and when i returned to the newly dubbed software, the problem still existed, my program wouldn’t run even now.

I looked high and low for an alternative, and found it in the form of a java script. While it is very useful, the simple scripting nature of it prevents me from optimizing and doing multiple scripts at once. I loved Xojo’s ability for multi-threading, and am pretty much wanting to create a program that will allow me to store the java scripts inside the application, and be able to run them, or have access to them. I admit this is more for personal use than anything else, but i’m still of the mindset i’d like to have it included and accessible somehow.

I can’t just re-write the java script into xojo… for one, i don’t understand the java language well enough, and two, it is well above my caliber of programming. However, finding i can call the java scripts via a shell command was fantastic news, so it is something I can use. I do think that virtualvolume might help, but that would be with the MBS java software most likely included.

I do apologize for any confusion I might have caused by not being clearer in the beginning, and I hope this clears things up a bit. I really do appreciate all the help i’ve received so far, you all have been marvelous! Thank you!

Please notice that JavaScript is not Java. you can run Javascript in a HTMLViewer.

I just verified rendering a Java class invisible prevents it from executing correctly. So your best bet is to delete the java file immediately after it has been executed.

Sorry, Christian. Old habit of mine is to refer to java as a script (not code) and i know it’s inaccurate, but I can’t seem to break away from it when i’m in middle of a thought. I know the differences between the two, let me reassure you of that, and i am talking java code not javascript. I’m really not trying to be confusing, just trying to clarify that i’m not using any javascript in this project, only java ‘.jar’ files.

Thank you, Michael, that does help. I’ll still try to tinker around with the virtual volumes for storing the files securely, and then if i need to dump them to the hard-drive as needed.

No problem.