0

Is there a JSR 223 implementation of the Java language? or even something that can parse and run Java?

My intentions are to make Java reload times almost zero during development like Javascript and PHP, without having to pay for JRebel or deal with that classloader/hotswap hell. So runtime performance doesn't matter, a simple treewalker would be more than fine.

Thanks.

  • 3
    Most modern IDEs support hot reload in debugging mode - if that's all you need. – assylias Nov 18 '16 at 12:35
  • I was thinking of something like Play Framework, where you run it from the console, when you edit the code and reload the browser it compiles the code and reloads it. But the compile times tend to kill productivity. – Pedro Batista Nov 18 '16 at 12:45
  • The IDE will only recompile the class you changed so the reloading time will be minimal. – assylias Nov 18 '16 at 12:54
  • are we talking about some big application? in that case you probably need an application container + automation in your IDE that builds + re-deploys as a save action. hot code replace is inherently dicy because you replace code but not state. – the8472 Nov 18 '16 at 15:09
  • Even with smallish apps the whole "make a change wait 10-20sec to see the results" cycle wastes a lot of time at the end of the day. Hot swapping code in the JVM is a well known mess. So I was thinking if there was a basic Java interpreter that could run business logic and every time a new request comes in, I would tear down and parse the whole thing kind like PHP. It's just an idea I would like to test. – Pedro Batista Nov 18 '16 at 15:44
  • The title “Java implementation in Java” is not sufficient to tell the reader that you are talking about a Java interpreter. That term doesn’t even show up in the question’s body. The tags `[jvm]` and `[classloader]` are misleading too. – Holger Nov 18 '16 at 16:37
  • A "Java interpreter" written in Java is a "Java implementation in Java", if it uses the Scripting engine of JSR 223, it has to run on the JVM. I still think it's pretty clear. – Pedro Batista Nov 18 '16 at 17:54
  • Have a look at http://stackoverflow.com/questions/12173294/compile-code-fully-in-memory-with-javax-tools-javacompiler – Ivan Nov 19 '16 at 10:17

3 Answers3

0

Look at https://github.com/dcevm/dcevm + HotswapAgent https://github.com/HotswapProjects/HotswapAgent, it should match with your requiremets

skybber
  • 339
  • 3
  • 12
0

Technically, it is possible. However, this is rather a smell in your application and you better to just pick a proper tool for the task. There are plenty of JRebel alternatives out there. Just pick and try.

Community
  • 1
  • 1
Anton Arhipov
  • 6,157
  • 1
  • 31
  • 40
0

I think it is theoretically possible. However every process certainly takes a certain amount of time to be done, so the idea of making the Java reload times almost zero during development like Javascript and PHP is quite impossible. Like Anton Arhipov said, there are plenty of JRebel alternatives out there. Just pick and try, whatever makes the reload time almost zero then do chose that. :)

Java slayer
  • 11
  • 2
  • 12