Java in ComputerCraft?
#1
Posted 07 July 2016 - 01:16 AM
#2
Posted 08 July 2016 - 04:27 PM
#3
Posted 08 July 2016 - 04:29 PM
#5
Posted 08 July 2016 - 11:37 PM
If you want to write your CC stuff in another language, use/write a compiler that compiles that language to Lua. Or if you don't care about speed, write an interpreter for it.
#6
Posted 10 July 2016 - 03:56 PM
DennisLysenko, on 07 July 2016 - 01:16 AM, said:
https://www.lua.org/pil/16.html
#7
Posted 25 September 2016 - 07:21 AM
You can use a custom ClassLoader and some reflection.
But this seems unfeasible, as there isn't much demand for it, and Lua works fine.
#8
Posted 03 October 2016 - 11:14 PM
If you peek around in the jar file, LuaJ is embedded in the jar.
CC uses LuaJ to handle Lua. That has a adaptation of luajava.
So, if I am correct, there is already support for Java in CC already, but Dan hasn't implemented it yet.
Sources: The LuaJ docs.
#9
Posted 04 October 2016 - 02:58 AM
#10
Posted 04 October 2016 - 10:24 AM
It should just be a matter of just putting it in the standard globals for CC.
Or, if you really want to sandbox it, it might take a little while if you need to limit some standard Java APIs, like JFrame and others.
I really doubt you'd be able to sandbox though.
#11
Posted 04 October 2016 - 11:38 AM
You've pegged the likely reason it's disabled, though - sandboxing it to the point where you could only use it within the confines of a single ComputerCraft "computer" (as opposed to, say, getting it to perform operations on the system running the Minecraft server) sounds like more trouble than it's worth.
#12
Posted 04 October 2016 - 01:44 PM
would be cool
#13
Posted 04 October 2016 - 01:55 PM
EveryOScrisp5dollarBill, on 04 October 2016 - 01:44 PM, said:
would be cool
That's not how any of this works... You wouldn't be writing Java. You would be writing Lua that accesses and uses the Java standard libraries. Otherwise you'd need to include a Java compiler in the CC distribution and things would get even hairier...
#14
Posted 04 October 2016 - 07:22 PM
isn't a good idea. Unless you find a way to sandbox the Java to the single computer, malicious code could be run to
bring down the server or even destroy important files. You can even crash a computer with the right code.
Could be useful, but to be honest it isn't really a good idea.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users