/* MainActivity.nrx */
/* Completed and tested, working example of NetRexxC using only dalvik vm */ /* to compile, convert java.class to dex and use it immediately on the device */ /* AndroidManifest.xml needs this permission */ /*<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />*/ /* Stock NetRexxC needs patch for Android Java home lib classpath and version */ /* Need to fix -savelog; will need for gui viewing errors NetRexxC.log */ /* Fix ecj from within NetRexxC instead of my non-Java-ness */ /* Add -errorlog to ecj args - will need for gui viewing */ /* Jason Martin [hidden email] 11-02-2012 */ package com.agrellum.annetrexx import android.os.Bundle import android.app.Activity import android.view.View import android.view.Menu import android.widget.Button import android.widget.TextView import android.os.Environment import android.content.Context import java.io.FileOutputStream import dalvik.system.DexClassLoader /*trace all*/ class MainActivity public extends Activity implements - android.view.View.OnClickListener method onCreate( savedInstanceState=Bundle ) super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) button1 = Button this.findViewById( R.id.button1 ) button1.setOnClickListener( android.view.View.OnClickListener this ) method onCreateOptionsMenu( menu=Menu ) returns boolean getMenuInflater().inflate(R.menu.activity_main, menu) return 1 method onClick(v=View) select case v.getId() when R.id.button1 then this.run_code() otherwise nop end method run_code() pack_name = "com.agrellum.annetrexx" file_name = "ostwoone" card_dir = Environment.getExternalStorageDirectory() program_code = 'package ' || pack_name || ';' || - 'import android.content.Context;' || - 'class ostwoone public;' || - 'method showsomething;' || - ' say "Android and NetRexx, now that is Warped.";' do nrxFile = File( card_dir || "/" || file_name || ".nrx") nrxFile.createNewFile() file_out = FileOutputStream(nrxFile) file_writer = OutputStreamWriter(file_out) file_writer.append( CharSequence program_code ) file_writer.close() file_out.close() catch e=Exception say e.getMessage() end flags="-nocompile -format -keepasjava -replace -savelog -sourcedir" source_code = card_dir || "/" || file_name || ".nrx" cmd = flags || ' ' || source_code org.netrexx.process.NetRexxC.main(cmd) compile_string = "-verbose -deprecation -extdirs \"\" -1.5 " || - "-bootclasspath " || - card_dir || "/lib/android.jar:" || - card_dir || "/lib/ecj.jar:" || - card_dir || "/lib/NetRexxR.jar:" || - card_dir || "/lib/dx.jar" || - " -classpath " || - card_dir || ":" || " -d " || - card_dir || " " || - card_dir || "/" || file_name || ".java" ecjMain = org.eclipse.jdt.internal.compiler.batch.Main( - PrintWriter(System.out), - PrintWriter(System.err), - boolean 0, null, null) ecjMain.compile(compile_string) dexing_string = [ String "--dex", - "--keep-classes", - "--output=" || - card_dir || "/lib/" || file_name || ".jar", - card_dir || "/./com/agrellum/annetrexx/ostwoone.class"] com.android.dx.command.Main.main( dexing_string ) dexPath = String card_dir || "/lib/" || file_name || ".jar" put_where_I_have_rights = getDir("files", Context.MODE_PRIVATE) optimizedDirectory = String put_where_I_have_rights cl = DexClassLoader( dexPath, - optimizedDirectory, null, getClassLoader() ) do dexed_class = cl.loadClass('com.agrellum.annetrexx.ostwoone') instance = dexed_class.newInstance() System.err.println( instance.toString() ) test_me = dexed_class.getMethod("showsomething",null) test_me.invoke(instance, null) catch e=Exception say e.getMessage() end _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
I did not think at the time but the package name should have really been "org.rexxla.netrexx". Right?
_______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
Jason,
as far as I do know, by now, the convention is: org.netrexx.author.xxxxx [.yyyy ...] at least my packages, soon to be updated on the Kenai repository, using SVN, do follow this convention, as, for instance: org.netrexx.thsitc.runtime.compatibility org.netrexx.thsitc.utils did follow this convention, as suggested by Rene and Chip, a year or so, ago :-) Have a nice weekend, anyway, and thanks for your excellent work! Your findings for using ANDROID will be *very useful* for me, starting 2013, when current scheduled deployments to Kenai and updating of my hoepage and my Kenai Project is done. Rene, and/or others more knowledgeable, please do correct me, when my comments are wrong, or conventions did change, since then :-) Thomas Am 03.11.2012 11:58, schrieb Jason Martin: I did not think at the time but the package name should have really been "org.rexxla.netrexx". Right? --
Thomas Schneider CEO ThSITC IT Consulting KG Erdbergstr. 52-60/1/13 1030 Wien http://www.thsitc.com Austria, Europe Skype ID: Thomas.Schneider.Wien Member of the Rexx Languge Asscociation (www.rexxla.org) Member of the NetRexx Developer's Team (www.netrexx.org) _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
Thomas Schneider, Vienna, Austria (Europe) :-)
www.thsitc.com www.db-123.com |
In reply to this post by Jason Martin
It's not really my package. The changes need to be included in NetRexx
and when I have time I will attempt a branch in svn and help Kermit some. When that is done, I welcome the more skilled programmers to clean it up an post it on the site. Build a package for the World and promote NetRexx. I got what I want. Millions and Millions of devices with a environment that will be easy to use even for the young and can serve a purpose long after the fad or technology has passed them by. There are already a lot of projects like OLPC and NetRexx should have it's place there too. _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
Great to hear, Jason!
Good luck, and thanks for all you did publish here .. Thomas. =============================================== Am 03.11.2012 21:29, schrieb Jason Martin: It's not really my package. The changes need to be included in NetRexx --
Thomas Schneider CEO ThSITC IT Consulting KG Erdbergstr. 52-60/1/13 1030 Wien http://www.thsitc.com Austria, Europe Skype ID: Thomas.Schneider.Wien Member of the Rexx Languge Asscociation (www.rexxla.org) Member of the NetRexx Developer's Team (www.netrexx.org) _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
Thomas Schneider, Vienna, Austria (Europe) :-)
www.thsitc.com www.db-123.com |
Free forum by Nabble | Edit this page |