Java Error opening registry key

Make sure you remove any java.exe, javaw.exe and javaws.exe from your Windows\System32 folder and if you have an x64 system (Win 7 64 bits) also do the same under Windows\SysWOW64. If you can’t find them at these locations, try deleting them from C:\ProgramData\Oracle\Java\javapath.

Adding Java Annotations at Runtime

It’s possible via bytecode instrumentation library such as Javassist. In particular, take a look at AnnotationsAttribute class for an example on how to create / set annotations and tutorial section on bytecode API for general guidelines on how to manipulate class files. This is anything but simple and straightforward, though – I would NOT recommend … Read more

Create a NinePatch/NinePatchDrawable in runtime

getNinePatchChunk works just fine. It returned null because you were giving Bitmap a “source” ninepatch. It needs a “compiled” ninepatch image. There are two types of ninepatch file formats in the Android world (“source” and “compiled”). The source version is where you add the 1px transparency border everywhere– when you compile your app into a … Read more

read the output from java exec

Use getErrorStream(). BufferedReader in = new BufferedReader(new InputStreamReader(pr.getErrorStream())); EDIT: You can use ProcessBuilder (and also read the documentation) ProcessBuilder ps=new ProcessBuilder(“java.exe”,”-version”); //From the DOC: Initially, this property is false, meaning that the //standard output and error output of a subprocess are sent to two //separate streams ps.redirectErrorStream(true); Process pr = ps.start(); BufferedReader in = new … Read more

Is it possible to compile and execute new code at runtime in .NET?

Yes! Using methods found in the Microsoft.CSharp, System.CodeDom.Compiler, and System.Reflection name spaces. Here is a simple console app that compiles a class (“SomeClass”) with one method (“Add42”) and then allows you to invoke that method. This is a bare-bones example that I formatted down to prevent scroll bars from appearing in the code display. It … Read more

Execute external program

borrowed this shamely from here Process process = new ProcessBuilder(“C:\\PathToExe\\MyExe.exe”,”param1″,”param2″).start(); InputStream is = process.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String line; System.out.printf(“Output of running %s is:”, Arrays.toString(args)); while ((line = br.readLine()) != null) { System.out.println(line); } More information here Other issues on how to pass commands here and here

execute c# code at runtime from code file

Code sample for executing compiled on fly class method: using System; using System.Collections.Generic; using System.Text; using System.Diagnostics; using System.IO; using System.Reflection; using System.Net; using Microsoft.CSharp; using System.CodeDom.Compiler; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { string source = @” namespace Foo { public class Bar { public void SayHello() { System.Console.WriteLine(“”Hello World””); … Read more