User forums > Help

using code::blocks with the GJC compiler

(1/2) > >>

svaens:
Hi,
Yeah. I would also like to be able to consider code::blocks as my IDE for java also.
I had a quick try at setting it up, but code::blocks seems firmly set to c/c++.....
I think perhaps if i would give my .java files a .cpp extension, i could trick it in to compiling the thing (with the gcj compiler, which I have set up as the selected compiler via the 'Global Compiler Settings ->Toolchain executables')

However, i don't want to have to 'trick' my IDE. I just want to use it. It would be nice.

Some have said 'why not just use eclipse' if you want an IDE for java.
Well, the reason I did not want to use eclipse for Java compilation is because Java is too slow. Why else do I want to be native compiling with GCJ, if not because I did not want the penalties of going through the JRE. Eclipse uses too many resources, and I never wanted to have to use it. I did not want to compile Java into anything but 'Native' (but i am interested in using the Java language). Hence my interest in using code::blocks, as a potential non-specific code compiler. It would be nice.

Do I have to trick code::blocks to compile my o/s native java app?
If yes, well, then I think i'll go somewhere else then.
If yes BUT, in the future code::blocks will be more flexible in this, then, i'll stick around.
If 'No' (I am currently doing something wrong in the setup). Then even better. Please help me out!

Kind regards,

svaens

p.s. I previously posted this somewhere else, but realised it was the wrong thread. Appologies.
:)

thomas:
I've never used it, but actually the Gnu Java compiler should be automatically invoked if you execute gcc with a Java file.... so this should work without any changes. (Hopefully?)

The only thing that remains then is opening Java files in the editor and having syntax colouring and everything, but that should work without problems, too.
I don't think we have syntax colouring for Java (never seen one) at this time, but by making a copy of the C++ one and editing a few lines, you should be able to get one in under 10 minutes.

svaens:
Thanks for the reply. Though I just wasn't sure how to go about telling the IDE that it should get the compiler to compile a .java file.

For example, If you add a .cpp file to a project, and right click on the file icon, the context menu will give you the option to 'Build'.
Also, if you do a project 'Build', all unbuilt files are compiled, and the whole thing linked etc.

If you load a .java file to the project (add file) there is no 'Build' option in the context menu,
and if you do a project 'Build' it tells you

"Skipping file (no compiler program set): test.java"

Question is, how do you tell code blocks what the compiler program for .java files is?

thomas:
Hmm... you can set the "compile" checkbox for individual files from the "properties" menu on each file. Of course that may quickly get annoying if you have a project with 500 sources...
I've done that in project that had 4-5 "alien" sources, works perfectly.

Apart from that, you can configure nearly every feature of the compiler plugin, just not what file extensions it recognizes as "compileable" automatically.  :?
You'd have to modify the sources (or make a custom compiler plugin) for that.

svaens:
hey thomas!

Thanks for your feedback.
Disappointing that It is not already configurable for java compilation...
BUT .... are you sure that direction "custom compiler plugin" would provide me with a fix?
As in, does the 'plugin' frame work provide me with the ability to provide such functionality?
While it doesn't come for free (as in, i have to write some code for it ;) ) it does sound interesting.
If, in doing so, i would provide myself with the solution I need, at the same time as providing extra functionality for the code blocks community. I might just have a look at it. Sounds a nice, non-invasive way, without having to directly modify the source.

Navigation

[0] Message Index

[#] Next page

Go to full version