[Q] Any way to compile java programs in android ? - General Questions and Answers

Is there a way to compile .java file to .class file and execute it
I wanted to compile c/c++/java programs, not for my phone but in my phone...
I searched but did not find an easy way for it.
At last I found out a real easy way to compile c/c++ by using adosbox for android.
I copied the turbo c 'tc' folder from my pc to my sdcard and used adosbox like command promt to go to 'bin' folder in tc and start tc.exe...
Then I could easily write and compile programs just like i did on the pc
But still no luck for java programs...
I copied the reqired java folder and then used adosbox to run the command "javac file.java" but it said "This Program Cannot Be Run in DOS Mode"
So if there is any other way to compile java programs in my phone
please help
Thanx in advance

Try looking at Eclipse, although Eclipse is a large desktop IDE, it includes its own Java compiler written in Java (in the part called "JDT core"), and if (as I hope) that Java compiler is not copyrighted by Sun/Oracle, you (or someone else already maybe) may be able to compile that part of Eclipse into a "native" Dalvik/Android App.
Googling the issue, I see that others have been asking for an Android port of Eclipse too, so maybe there will be some momentum going for this soon.

Related

Building and deploying from cupcake source code to my device - using Mac

Hi all,
I am trying to setup my Mac OSX (Mac Mini) to build and deploy the Cupcake source code and deploy the built images on my ADP1 device.
I must admit - I am no Linux guy, so a bit slow on understanding the various instructions.
My problem - I was somehow able to get the sources down to my Mac, and even run a successful MAKE.
But - got stuck there (could not figure out how to run the built images on the emulator).
So I decided to be brave and compile & install on my ADP1 device.
This is where I am stuck:
In the explanation at the Google site, they claim there should be a ".Repo" directory holding a file called "manifest.xml" in it, and that I should download and add to that directory a file called "local_manifest.xml".
I can not find such a ".Repo" directory, and hence - dont know where to put that file.
Any help would be highly appreciated !
Shimon Shnitzer
TAKEphONE said:
Hi all,
I am trying to setup my Mac OSX (Mac Mini) to build and deploy the Cupcake source code and deploy the built images on my ADP1 device.
I must admit - I am no Linux guy, so a bit slow on understanding the various instructions.
My problem - I was somehow able to get the sources down to my Mac, and even run a successful MAKE.
But - got stuck there (could not figure out how to run the built images on the emulator).
So I decided to be brave and compile & install on my ADP1 device.
This is where I am stuck:
In the explanation at the Google site, they claim there should be a ".Repo" directory holding a file called "manifest.xml" in it, and that I should download and add to that directory a file called "local_manifest.xml".
I can not find such a ".Repo" directory, and hence - dont know where to put that file.
Any help would be highly appreciated !
Shimon Shnitzer
Click to expand...
Click to collapse
".Repo" is a hidden folder any folder with a "." in front of it will be hidden, enable the viewing of hidden folders and you'll find it.
Thanks !
I knew I was probably missing something simple...

[Help!] Compiling an Android APK on Windows using Eclipse

I recently worked on a theme for some home alternative apps but when I tried to compile it in Eclipse, things seemed to be missing (for example Keytool and Jarsigner) which are not in my SDK directory anywhere.
I was able to get the theme to work by using the APK from someone else's, replacing the images with mine and signing using the Autosign tool downloaded from XDA but I was unable to change the name of the app in the Manifest.
So my question is, is there a way to compile in Windows at all? Reading the guide on the developers.android page didn't answer anything for me.
Also, would there be anyone willing to walk me through that? If not, just knowing if its possible is enough for me.
Windows 7 64-bit
im on windows 7 64 and I can compile my apps without any problem. right click on the folder of your app -> android tools -> export as signed / unsigned (which ever you prefer)
The "keytool" and "jarsigner" programs are in the JDK, which you'll need to get from Oracle (formerly known as Sun). Set the JAVA_HOME environment variable to the JDK directory; in my case, C:\Program Files\Java\jdk1.6.0_18, and add the JDK's bin path--in my case, C:\Program Files\Java\jdk1.6.0_18\bin--to your PATH environment variable. You may need to logoff/logon or reboot for everything to settle out. If you get the latest JDK, the paths should end in _20 instead of _18.
jarsigner is not needed in eclipse as eclipse will sign and zipalign the apk for you.
File | Export
Choose Android | Export Android Application
Create a new keystore via the tool and it will automatically sign and zipalign creating a nice new apk for you

[Q] looking for a guide to how to cross compile C program to Android BIN file.

Hi all,
i'm new here, but i'm not new to android.
well i program in C, C++ and JAVA. and i'm wrinting an APP that needs some low level programing that use the Bluetooth.
now i have the code already running on my PC but i want to make a bin file that i can run through the terminal in my HTC desire.
my question is, where can i find a good guide that can explain me how to cross compile C code into an ARM arch, so that later on i can use in my android?
thanks to all!

[how to] Develop on Windows RT: A C# Scratchpad

Steps:
(Yes, you need Jailbreak first.)
Download CsBox.zip from this thread.
Unzip the CsBox folder to your user's folder (in my case it's C:\Users\ssaaxx\Desktop\Scripts\)
Get Notepad++ and run it (from the App porting thread)
In Notepad++, Create and save a C# code snippet (A sample code snippet can be found in TestCSharp.cs.txt attachment)
In Notepad++, click "Run" menu --> "Run..." --> Input following text and run (or you can save it as a command shortcut if you want to)
C:\Users\ssaaxx\Desktop\Scripts\CsBox\RunCsSnippet.bat "$(FULL_CURRENT_PATH)"​
There you go!
* Do use the right folder path for you.
------------------
How does it work?
Windows RT ships with a CSharp compiler (csc.exe), except it's not working by default because of missing some referenced dlls.
So I commented out the missing references from the rsp file, and it worked.
After this it's just some basic scripting and Notepad++ integration.
-----------------
Edit: fixed a bug. thanks Calebsem.
Edit: Hide compiler output when compiling succeeds.
cool!
Very cool little hack! I've been looking forward to a way to program C# on the Surface!
Just to demonstrate what this "scratchpad" is capable of, I'll update this reply with some handy scripts:
1. Script to enable Adobe Flash for specified website / domain: EnableFlash.zip
...
* Download the zip and unzip the cs file. Load it in Notepad++ and run.
ssaaxx said:
Steps:
How does it work?
Windows RT ships with a CSharp compiler (csc.exe), except it's not working by default because of missing some referenced dlls.
So I commented out the missing references from the rsp file, and it worked.
After this it's just some basic scripting and Notepad++ integration.
Click to expand...
Click to collapse
Thanks for the cool utility and guide! I was able to work it out to compile a multi-file .NET project. One snag that I hit in the endeavor was about the resources. ResGen.exe does not come on the RT version of Windows. I used my desktop to compile the various resources and then stuff them into the directory tree. At last, the program I re-built was completed and launched well. It consists of an exe and two dll files. All's well for that experiment. Unsure if I can make the time to do a clean room build of ResGen.exe for ARM.
I'm surprised this topic didn't get as many posts as it did. Found this thread through a youtube video, and this has got to be one of the best kept secrets for code development on the RT. A quick replacement of the csc.rsp file after toying with permissions, and adding the csc.exe to my PATH basically allows command-line C# building.
Wondering if the missing DLLs actually appear on different versions of RT. Not that these specific namespaces are something I regularly use, but it would be nice not to have to comment things out this way.
ssaaxx said:
Steps:
(Yes, you need Jailbreak first.)
Download CsBox.zip from this thread.
Unzip the CsBox folder to your user's folder (in my case it's C:\Users\ssaaxx\Desktop\Scripts\)
Get Notepad++ and run it (from the App porting thread)
In Notepad++, Create and save a C# code snippet (A sample code snippet can be found in TestCSharp.cs.txt attachment)
In Notepad++, click "Run" menu --> "Run..." --> Input following text and run (or you can save it as a command shortcut if you want to)
C:\Users\ssaaxx\Desktop\Scripts\CsBox\RunCsSnippet.bat "$(FULL_CURRENT_PATH)"​
There you go!
* Do use the right folder path for you.
------------------
How does it work?
Windows RT ships with a CSharp compiler (csc.exe), except it's not working by default because of missing some referenced dlls.
So I commented out the missing references from the rsp file, and it worked.
After this it's just some basic scripting and Notepad++ integration.
-----------------
Edit: fixed a bug. thanks Calebsem.
Edit: Hide compiler output when compiling succeeds.
Click to expand...
Click to collapse
i dont work, he says "WARNING CS2008 NO ORIGINAL FILE SPECIFICATED"
i post an image (sorry but is in italian)

Possibly Close To Solving Java on Windows RT?

Alright I've searched for a while to find a way to get my Surface 2 to run .java files as I have Notepad++ on here. I've seen that there is a Java version for ARM architecture but it's for the Raspberry Pi.
What I've done so far, and I'm hoping that someone else will be able to take it further as it will be a very valuable tool, is;
-Download the Java file 'Linux ARM 32 Hard Float ABI' from http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
-Extracted the .tar.gz file using 7Zip, then extracted the .tar file the same way.
-Moved the jdk folder into C:\Program Files\Java (where it would go if being installed on a normal Windows computer)
-I then used an elevated Command Prompt to open Environment Variables and added JAVA_HOME to the system variables with the value 'C:\Program Files\Java\jdk1.8.0_73'. I also edited the Path variable to include 'C:\Program Files\Java\jdk1.8.0_73\bin'
Now as far as I know surely that's half the job done? But if I try and do anything in cmd that starts with 'java' it says it's not recognised.
Have I done the Paths wrong? Another thing I noticed is that on a Windows 10 PC there are also Java files in 'C:\ProgramData\Oracle\Java\javapath' but this is the only difference between Java on my laptop and Surface.
The problem is these files are compiled for x86 or x64 architectures and won't do anything on my Surface.
Considering the files in ProgramData are now the only Java differences between my laptop and my surface and I've been told it's possible to install Java without using the installer and just copying files across a system, would it be possible for anyone to find a way to have those files on an ARM system or a way to run it without those?
Bear in mind this is the first time I've properly tried to do anything like this so if it's a bad idea please let me know nicely lol. I just haven't seen anyone go down this route, maybe there's a reason but it intrigued me so I thought I'd ask.
Thank you
You can't run Linux binaries on Windows. So downloading the Linux version of JAVA will not work.
EDIT: It's an interesting concept. It should be theoretically possible to compile OpenJDK to work on RT.
abtekk said:
You can't run Linux binaries on Windows. So downloading the Linux version of JAVA will not work.
EDIT: It's an interesting concept. It should be theoretically possible to compile OpenJDK to work on RT.
Click to expand...
Click to collapse
Oh I see, yeah I wasn't sure how far it could go but I thought I'd put it out there. I have absolutely no idea how to go about compiling that so I'm hoping someone sees this and does everyone a favour as this would be an extremely useful tool to have!

Categories

Resources