Program in Java?

Does anyone know of any IDE or other tool that I can use to program for vex in the Java programming language?

And if so, what is it, and is it FVC legal?

  1. Java isn’t legal in FVC.

  2. Check out the last project listed on the page at this URL:


(This probably wins thread revival of the century… :D)

I’m studying Java now, and am beginning to love the language. The tough bit is that there’s no (easy) way to use it for VEX right now. So…

Anyone know of a group that’s written a code library for VEX? If not, any idea on how write a library for the Cortex? (I’m not really volunteering for this job just yet… It would probably take waaay longer than I have to offer it, but I would be interested to see how it would work.)

FWIW, The LEGO NXT can use Java…


The Center for Computation and Science at LSU were developing a java virtual machine last year, don’t know how far they got. You could try contacting Bryce Lelbach ( blelbach AT cct DOT lsu DOT edu) but he has not posted here in months.

I’ve done a little work on using C++ development for the cortex in eclipse with the Sourcery C++ compiler for arm (same one EasyC uses, it’s free from Mentor Graphics), not quite there yet and currently it needs a valid EasyC license to legitimately use their startup code. Not sure how far I will take it as you end up with the same result just in a more complicated way.

The Java VM is much more comprehensive than that of RobotC - I imagine it would be tough to compile it for the cortex without cutting many features from the language.

Though there isn’t much of a point to using a VM as comprehensive as Java on the cortex. The objective of Java is to abstract the user from the hardware so the code will only need to be compiled once and will then execute fine on any platform which properly implements the VM. As your code is being compiled for a very specific platform there isn’t too much of a point other than wanting to work with the syntax & in the managed environment (which RobotC already offers).

I love Java too (not as much as I love C# and .Net) but it would be unpracticle for me to program the cortex using it.

I was thinking of looking in to this too. Any platform that supports C can also support C++ (but I question how much of the standard C++ library would actually be practicle to use on the Cortex). The first couple of C++ compilers would compile the C++ code to C, and then run the C code via a C compiler. Ofc they scrapped this because there were a lot of areas where the compiler would miss potential for code-optimization. Regardless, I am definitely going to take a look at this though, thanks!

Thanks for the info… missed that while searching. I’ll definitely look into that.

Java is the OOP language that I know the best, and I’ve grown to love OOP. That was my main reason for wanting Java… :wink:

Hmm… C++ is also object-oriented, so I probably should start learning that and hope someone finds a way to run it on VEX…


Everything we do in C++ we can also do in C; mind you people have argued that C++ is C with OOP jammed half-way down its throat (lol!). Seriously though, my entire robots code is Object-Orientated (using interfaces and inheritance) and its all written in C (nothing that matches up to the kind of OOP you find in Java or C#). I have seen some pretty impressive stuff done by the BOOST C++ library (compile-time reflection) so C++ OOP really isn’t all that bad.

Unless your counting all the Included Libraries, the basic features of Java aren’t much more than C++.

While taking the Introduction to Programing class at the local Community College, which uses Java, I was surprised how much Java looks like ‘C’, and ‘C++’… When leaving out the Dozens of Libraries include with Java, the main differences are the ability to use Variable Names, Beginning with a ‘$’, and the weird application of Enumerated Types.
I took my First C++ Class concurrently with the Java Class… I don’t think I learned a whole lot more than I had already learned on my own with C++. I wish they had an advanced C++ Class at the College…

I am in Agreement… One of the “Many Features” of Java, seems to be the Creating a “new” Instance of String or Structure and the Auto-Garbage Collection to Dispose of it, which C# seems to Mandate as well… I am perfectly happy, Re-Using the “variable” I have, rather than Allocating a “new one” Every Time, to do a Split or Concatenation…
On a “Constrained Platform” I would rather be in charge of my Own Garbage, rather than letting the System manage it…

For very small systems, ( Like 8 Bit Processors, which the ‘C’ Compilers never seem to support Dynamic Memory Libraries. ) C++ seems to be unavailable… All the Commercial Compilers I have looked at seem to Only Support Assembler and ‘C’ for 8 Bit Targets… Move up to 16 Bit and 32 Bit Targets, and you see C++, Pascal, Java, and even Ada.

I could think a use for most all of the C++ Standard Library on the Coretx… All Dynamic Memory allocation, Character and String Manipulation, Math, even File Libraries could be put to use… If you add a MicroSD Card to the Cortex and FAT32 File System Library, and all those File Handling Functions would be fantastic…

You are referring to the CFront Compiler… I have had “moderately long” discussions with other C++ Programmers in the Mid 1990’s, about most of the Features of C++ could be Done with straight ‘C’… I don’t think they believed me… Even after using the Internet, and showing them the AT&T CFront Compiler page… :wink:

I have not tried Linking in Other Libraries to EasyC, but you could develop Your Code in C++, and Compile into a Library, then Link it in to an EasyC Stub Program, and call your Library Functions…

I don’t think you could compile it Directly, because you don’t have control over the Compiler Command Line Parameters from EasyC.

My mistake, I meant implementing the virtual machine was a much more comprehensive task.

You made some very resourceful comments in your post, thanks :slight_smile:

Lol, that I can imagine.

It is possible (although I have not tried it, no real reason to do so yet) to create an EasyC program completely from the command line. With a new project from the competition template selected, the following happens when you hit compile.

The following files are created under
C:\Documents and Settings\TheUser\Application Data\Intelitek\easyC V4 for Cortex\Temp\


These are “normal” C files, main, Initialize, Autonomous and OperatorControl are the provided stubs. MainIO.c looks like the following.

#include "Main.h"

void IO_Initialization(void)
	SetCompetitionMode ( -1, -1 ) ;
	SetAutonomousMode ( 0 ) ;
	SetTeamInfo ( "000easyC" ) ;
	DefineControllerIO ( 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0 ) ;
	DefineImeTable ( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ) ;
	DefineMotorTypes ( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ) ;

Globals.c has any global variable definitions, it will be blank for an empty project.

Each of these is compiled with the following flags (more or less, I removed one include path and also the path for main.c and main.o)

arm-none-eabi-gcc.exe -MD -D_STM32F103VDH6_ -D_STM3x_ -D_STM32x_ -mthumb -mcpu=cortex-m3 Main.c -o Main.o -I C:\Program Files\Intelitek\easyC V4 for Cortex#Tools\API -I C:\Program Files\Intelitek\easyC V4 for Cortex#Tools\STM32F103VD\inc -c -fsigned-char -O1 -ffunction-sections -Wall -mlittle-endian

After that the linker is called with the following flags, I know it’s very long and I also shortened a few paths.

ld.exe --sysroot=c:\program files\intelitek\easyc v4 for cortex#tools\arm-gcc\bin…/arm-none-eabi -X -u _start -Lc:/program files/intelitek/easyc v4 for cortex/#tools/arm-gcc/bin/…/lib/gcc/arm-none-eabi/4.5.1/thumb2 -Lc:/program files/intelitek/easyc v4 for cortex/#tools/arm-gcc/bin/…/lib/gcc/arm-none-eabi/4.5.1/…/…/…/…/arm-none-eabi/lib/thumb2 -Lc:/program files/intelitek/easyc v4 for cortex/#tools/arm-gcc/bin/…/arm-none-eabi/lib/thumb2 -Lc:/program files/intelitek/easyc v4 for cortex/#tools/arm-gcc/bin/…/lib/gcc/arm-none-eabi/4.5.1 -Lc:/program files/intelitek/easyc v4 for cortex/#tools/arm-gcc/bin/…/lib/gcc -Lc:/program files/intelitek/easyc v4 for cortex/#tools/arm-gcc/bin/…/lib/gcc/arm-none-eabi/4.5.1/…/…/…/…/arm-none-eabi/lib -Lc:/program files/intelitek/easyc v4 for cortex/#tools/arm-gcc/bin/…/arm-none-eabi/lib -T C:\Documents and Settings\TheUser\Application Data\Intelitek\easyC V4 for Cortex\Temp\easyCInputs.ld -static --gc-sections -Map Main.lst --start-group -lgcc -lc --end-group

A lot of that is pointing the linker at the right folders for the library files.

The linker script (easyCInputs.ld) looks like this, it is created dynamically so will include more object files if the project has additional source.

SEARCH_DIR("C:\Program Files\Intelitek\easyC V4 for Cortex\#Tools\STM32F103VD\Scripts")
SEARCH_DIR("C:\Program Files\Intelitek\easyC V4 for Cortex\#Tools\STM32F103VD\Startup")
SEARCH_DIR("C:\Program Files\Intelitek\easyC V4 for Cortex\#Tools\STM32F103VD\easyCRuntime")
SEARCH_DIR("C:\Program Files\Intelitek\easyC V4 for Cortex\#Tools\STM32F103VD\Link")
INPUT("C:\Documents and Settings\TheUser\Application Data\Intelitek\easyC V4 for Cortex\Temp\Main.o")
INPUT("C:\Documents and Settings\TheUser\Application Data\Intelitek\easyC V4 for Cortex\Temp\MainIO.o")
INPUT("C:\Documents and Settings\TheUser\Application Data\Intelitek\easyC V4 for Cortex\Temp\Globals.o")
INPUT("C:\Documents and Settings\TheUser\Application Data\Intelitek\easyC V4 for Cortex\Temp\Initialize.o")
INPUT("C:\Documents and Settings\TheUser\Application Data\Intelitek\easyC V4 for Cortex\Temp\Autonomous.o")
INPUT("C:\Documents and Settings\TheUser\Application Data\Intelitek\easyC V4 for Cortex\Temp\OperatorControl.o")
INCLUDE "easyCRuntime.elf.ld"

It includes other scripts, you can find them in the #Tools\STM32F103VD\Scripts subdirectory. The first one looks like this.

EXTERN( __io_putchar )
EXTERN( _write )


INCLUDE "STM32F103_384K_64K_FLASH.ld"

Other object files and libs could be included by modifying this file.

The output from the linker is an .elf file called easyCRuntime.elf

Finally a .hex file is created using objcopy, again I took out the path names.

arm-none-eabi-objcopy.exe easyCRuntime.elf --target=ihex Main.hex

So it should be possible to do all the following from the command line or makefile. EasyC seems to use the normal compiler and objcopy executables, the linker used is in a different subdirectory and I’m not sure how it differs from arm-none-eabi-ld (they are probably the same but I did not check yet).

Having just posted all this, I do advise against trying to modify any of this, In fact it’s probably a bad idea to have even put this up, it’s really just to give an idea of what happens under the hood and there really is no need to use any of this information. Having said that, all of this information was pulled just by using careful observation (well and a couple of sneaky tools I created :slight_smile: ) so it’s fair game.

I Agree… I would expect that CMU did it with RobotC, because they Could Leverage their Higher Level Designs and Libraries, independent of the Microcontroller…

Since the Vex PIC is 8 Bit, the NXT and Coretex are 32 Bit, and the Conditionals seen for the Arduino Additions, being possibly either 8 Bit or 32 Bit Microcontrollers, the VM Minimizes the Unique Parts of RobotC, leading to a Faster Development Cycle when “porting” to different Hardware…

Thank You… :wink: I try very hard to be Through and usually Concise…

Sounds similar to the “sneaky tools I created”… Want to Exchange Design Notes??

I have thought of a way to “re-purpose” my tools, to possibly blend the C++ ( or other GCC Compiler ) right on in…

( REALLY INQUIRING MINDS, seem to think alike:wink: )

Also, of a Related Note…

I recently received a email bulletin from EETimes / Embedded Systems, about, Embedded Programming, and a Link to an older article from AUG-2009 titled, Real men program in C.

( Please Note that the Link to what “Linus Torvalds thinks about C and C++” by reader robert.berger, contains Stronger Than ‘G’ Rated Language )

( I don’t consider myself an expert, but after programming in ‘C’ for 23 years, I tend to Agree with Linus… )

Reminds me of this blog post from a couple of week ago discussing the Duqu framework. Here is a quote from it.

Haha, if “old school” is 10-12 years ago then I must be “prehistoric”.