Search code examples
javaobjective-cbeanshellobjective-c-runtimej2objc

how to use .jar libraries in objectiveC ios Project Using j2objc?


the goal is make an ios app with this features:

-download a source code file as a text and compile or interpret at runtime

-this Plain Text source code needs to capable of UI Manipulation , Os and Hardware functionality access. i have done the exact same thing in Android Using Beanshell.

(sorry for bad english)

i have done my researches and checked a lot of libraries like Clang and objc-eval (see Convert/compile a string into executable code in Objective-C) they had no use in my scenario .

now i attempt to do something that may not meet the features but, it can be the start point of a cool project.

i want to use beanshell in objective-c project using the j2objc googles java compiler. see https://github.com/google/j2objc

the j2obj Hello world sample project works fine, but i need to include the beanShell Jar file to the project. the j2obj is a source compiler and cant compile binary files , so i had no luck with attaching beanshell source to java environment path.

the odd thing is in Java environmet Path , all files are .h files , not a .java file , nor .jar.

the question is:

-How can I include beanshell .jar file to my project , so the J2objc can compile It , and after that i use beanShell in run time?

-any opinion about the project or any way to actually do this project will be appreciated.

===== EDIT 1

i think its start to make sense for me now. i tired to run this terminal command:

/usr/local/j2objc-2.0.5/j2objc /usr/local/j2objc-2.0.5/frameworks/bsh.jar

and the result is full of " cannot find symbol " errors. it seems the j2obj cant compile the beanshell library at all.

i dont know if im in a right direction or not. just tryng to share the progress here


Solution

  • I'm the tech lead for j2objc, and strongly recommend that you don't waste any more time attempting to use it for your project -- it's not designed to ever support the features you described. Lua may be an option: there are instructions for how it can be used on iOS, though I haven't tried it.