Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8138649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:33:40+00:00 2026-06-06T11:33:40+00:00

While trying to find an answer to Android Jasper Reporting I found out that

  • 0

While trying to find an answer to Android Jasper Reporting I found out that there are two other questions to be answered therefor, which I been asked to ask as a question, not as an answer ;):

My questions are now: “Is there any compiler to use directly on the device” AND “how to execute such without rooting the device.
If anybody could give me a hint I would really appreciate it…


I looked a little time forward on this approach, and found apps which makes it possible to create APKs directly on an Android device which is NOT rooted:

  • TerminalIDE – https://play.google.com/store/apps/details?id=com.spartacusrex.spartacuside&hl=de
  • JavaIDEdroid – http://code.google.com/p/java-ide-droid/
  • AIDE – https://play.google.com/store/apps/details?id=com.aide.ui&hl=en

Looks like they’re using the compiler from eclipse and a ported dex converter. Now I’m trying to figure out how to do the same.

Sure: get the source code and look into it. But while I’m having curious problems to get a connection to the servers and trying to solve it, I follow the plea to ask this question here. Hoping both to help others with it and also getting an answer for myself 😉


I took the org.eclipse.jdt.core_3.7.3.v20120119-1537.jar from the plugin directory of my indigo and tried following code:

     org.eclipse.jdt.internal.compiler.batch.Main ecjMain = new org.eclipse.jdt.internal.compiler.batch.Main(new PrintWriter(System.out), new PrintWriter(System.err), false/*noSystemExit*/, null, progress);
     System.err.println("compiling...");
     ecjMain.compile(new String[] {"-classpath", "/system/framework", storage.getAbsolutePath()+"/Test.java"});
     ecjMain.compile(new String[] {storage.getAbsolutePath()+"/Test.java"});
     System.err.println("compile succeeded!!!");

Sometimes the Exception was thrown that java.lang.Object could not be found and othertimes it stuck doing nothing while heating up my processor with 100% usage … …

At this time i could not figure out what is happening and why. And in cause that i have other work to do this part has to wait a little.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T11:33:42+00:00Added an answer on June 6, 2026 at 11:33 am

    I succeeded after taking inspiration from source of JavaIDEdroid and realizing that I’m dumb (for a time I tried to uses the compiler with the dexified framework classes on the device – which naturtally could not work).
    After i succeeded compiling my Test.java with a copy of ADTs android-jar on sdcard I just had to load the classes with the DexClassLoader.
    While informing myselft about how to do that I found this nice article Custom Class Loading in Dalvik which inspired me at least to write this piece of code:

        File storage = getDir("all41", Context.MODE_PRIVATE);
    
    
        System.err.println("copying the android.jar from asssets to the internal storage to make it available to the compiler");
        BufferedInputStream bis = null;
        OutputStream dexWriter = null;
        int BUF_SIZE = 8 * 1024;
        try {
              bis = new BufferedInputStream(getAssets().open("android.jar"));
              dexWriter = new BufferedOutputStream(
                  new FileOutputStream(storage.getAbsolutePath() + "/android.jar"));
              byte[] buf = new byte[BUF_SIZE];
              int len;
              while((len = bis.read(buf, 0, BUF_SIZE)) > 0) {
                  dexWriter.write(buf, 0, len);
              }
              dexWriter.close();
              bis.close();
    
        } catch (Exception e) {
            System.err.println("Error while copying from assets: " + e.getMessage());
            e.printStackTrace();
        }
    
    
        System.err.println("instantiating the compiler and compiling the java file"); 
        org.eclipse.jdt.internal.compiler.batch.Main ecjMain = new org.eclipse.jdt.internal.compiler.batch.Main(new PrintWriter(System.out), new PrintWriter(System.err), false/*noSystemExit*/, null);
        ecjMain.compile(new String[] {"-classpath", storage.getAbsolutePath()+"/android.jar", Environment.getExternalStorageDirectory().getAbsolutePath() + "/Test.java"});
    
    
        System.err.println("calling DEX and dexifying the test class"); 
        com.android.dx.command.Main.main(new String[] {"--dex", "--output=" + storage.getAbsolutePath() + "/Test.zip", Environment.getExternalStorageDirectory().getAbsolutePath() + "/./Test.class"});
    
    
        System.err.println("instantiating DexClassLoader, loading class and invoking toString()");
        DexClassLoader cl = new DexClassLoader(storage.getAbsolutePath() + "/Test.zip", storage.getAbsolutePath(), null, getClassLoader());
        try {
            Class libProviderClazz = cl.loadClass("Test");
            Object instance = libProviderClazz.newInstance();
            System.err.println(instance.toString());
        } catch (Exception e) {
            System.err.println("Error while instanciating object: " + e.getMessage());
            e.printStackTrace();
        }
    

    The Test.java only contains one method:

    public String toString() {
        return "Hallo Welt!";
    }
    

    To get it running you need the jars jdt-compiler-x.x.x.jar (found in plugins directory of eclipse) and dx.jar (found in directory platform-tools/lib of Android SDK)


    Not really hard 😉
    And now I will find out what to change in source of JasperReports to get it work on our beloved Android devices 😀

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to android, and I've been trying for a while to find out
While trying to use XMLWorkerHelper.GetInstance().ParseXHTML() i find that it is really strict. Any wrong
While trying to profile my Perl program, I find that Math::Complex is taking up
ive read all the scrollTo questions and couldnt find the answer. im trying to
I've searched for quite a while trying to find an answer to this without
I've been trying to find an answer for this for a while.... Any ideas
I was trying to find an answer for this question for a while but
Suppose we have buyers and sellers that are trying to find each other in
I've been trying to find the answer to this for a while today and
I've been trying to find an answer for this for a while and I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.