Re: Loading .java Files
"David Lee" <[email protected]> Sun, 26 Jun 2011 16:51:43 -0400
| Newsgroups | gmane.comp.java.beanshell.user |
|---|---|
| Message-ID | <[email protected]> |
I don't believe that beanshell is 100% backwards compatible with Java. Especially Java 1.6. bsh java compatibility syntax is pre 1.4. Plus even if the syntax is compatible, as you have discovered, its use case is not. You can load a java class file into bsh but you cannot access it from java natively (only from bsh). The internal bits it creates from parsing "java" code are not java JVM Bytecode. Its beanshell interpreted runtime codes. So in some cases you might get away with reading pure java files, in other cases maybe not. In no cases is it exactly the same. If you want pure java you need to use javacc or equivalent and use a classloader. Its actually not as complicated as one might imagine. As for beanshell2 ... I'll let others comment, I haven't followed it for a while. ---------------------------------------- David A. Lee [email protected] http://www.xmlsh.org -----Original Message----- From: [email protected] [mailto:[email protected]] Sent: Sunday, June 26, 2011 4:25 PM To: 'David Lee' Cc: beanshell-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Subject: RE: [Beanshell-users] Loading .java Files > ------------ > BSH has java-incompatible syntax. A IDE that is expecting java will > produce errors when given bsh code that doesn't conform to java. > For example a method with no class. Or using the {} notation > to access a > Hash or bsh iterators, typeless variables, closers and > anything else in bsh > which isnt java. Yes. Java isn't Bsh compatible. But Bsh is Java compatible? I mean that Bsh can eval successfully every script in Java-1.4 syntax? > bsh is what it is. If you believe that is 'Not that elegant' > that's an opinion. I doesn't meant Bsh with "not elegant". I meant that my code removes the "class {}" lines before loading the script. > And no, the original bsh is no longer in development, but > 'beanshell2' was > forked and is in development by another set of authors. Hm, I cannot find any docs at http://code.google.com/p/beanshell2/. What are the enhancements to the original Bsh? Thank you! ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2