Converting java source to c/c++ source

hiya,

I have recently created an image compressor. I now want to make a video codec using this compressor.

Do that i need to convert my java code to c… however i have had no luck in my searches on google for a tutorial on how one may go about doing it.

If you know of any resouces please do let me know!

Thanks!

just kill me :wink:

[quote]just kill me :wink:
[/quote]
whats your peferred way :wink:

I dont want to convert it, but it looks like the only way i will be able to make a codec usable by virtual dub/ mplayer :frowning:

[quote]I dont want to convert it, but it looks like the only way i will be able to make a codec usable by virtual dub/ mplayer :frowning:
[/quote]
Yeah you have no choice it’s true. There are few Java to C++ programs out there.

I don’t see a problem with this. If you know Java and you know C or C++ then simply rewrite your code in the other langauage. I’ve experienced no problems porting code between Java and C++; the syntax is a little different for your class definitions but the rest is identical - just pass everything by reference in your C++ code. Going the other way can be bit trickier of course…

Ah, see thats the rub… i have only really started programming in c/c++

only today have i read up and tried to implement templates such that i can hopefully use the STL when migrating my lists and sorting from java.

[quote]Ah, see thats the rub… i have only really started programming in c/c++
[/quote]
Welcome to hell, kid.

Your gonna learn why so many of us old C/C++ programmers have totally switched to Java :frowning:

[quote]just pass everything by reference in your C++ code. Going the other way can be bit trickier of course…
[/quote]
This totally ignores the problems of deleting objects. The algorithm in general is the easy bit to port… it is the memory management, lack of a ‘finally’ block, no labelled breaks, etc. that are going make it hell.

/me grows more apprehensive :’(

Oh well, i will think of it as a C++ learinging exersize… of PAIN :wink:

Besides, the automatic tools (like the ones that covert from Pascal to C) produce code that is so horrendously bad you have to go in and manually clean it up anyway. Manually porting the code will create code that’s clean and maintainable.

HAHAHAHAHAHHA

Way to go Java mongers!!

Java is dumbed down C++. The syntax is almost the same, but C++ has some more advanced features.

It should not take long. Prototyping is nice and easy. Once you understand how the program works everything is pretty much the same. And almost as portable.

Right now, I’ll only use few features of Java in my project. Mainly JavaDoc, because it was the first good documentation method I ever met. Other than that I don’t really fiddle with Java, because there are good platform toolkits for C++ and I don’t like the complexity java adds when dealing with opengl extensions.

So my point was that don’t listen to these fanatics. Start download gcc, fire it up and do it. If you start now you’ll be finished by sunday. Also it will make you appreciate the beauty of multiple inheritance and pointers.

And my point holds. Java is a lot like C++, except for college kids who think “Oh my, Why can’t pointers be like butterflies made out of candy! WHy can’t they fly around and why can’t you snatch one when you are hungry! Oh noes what is this closed standard language! Yay it is Java!!”

;D ;D ;D ;D ;D ;D

Ooh, cool! A troll! =D

hugs Captain-Goatse

[quote]Also it will make you appreciate the beauty of multiple inheritance and pointers.
[/quote]
:o

The intricacies of multiple inheritance FAR outweight its beauty!
Pointers on the other hand, can be used for some nice stuff, though there usage is riddled with problems.

Every language has its ups and downs. A tool, is a tool, is a tool.

And captain-goaste, you’re a tool. :slight_smile:

Kev

First one down. How come you were the only one to catch this?

How about a concrete example? You don’t have to use it. I happen to like it. C++ is multi paradigm language. Java is not.

Anyway my point is that don’t get too patriotic of anything. Don’t restrict yourself to Java. Look, the world is full of functional languages like ocaml, lisp and haskell. lol pun lol.

I do my AI in lisp abd this is only because of sun’s relatively open* stance I’ve found it impossible to intergrate anything else but javadoc into my project. Sad isn’t it?

*closed

[quote]Every language has its ups and downs. A tool, is a tool, is a tool.

And captain-goaste, you’re a tool. :slight_smile:

Kev
[/quote]
Dude,

You are making fun of me and I do not know how =(
Perhaps C++ dumbed me down ::slight_smile:

Perhaps :slight_smile:

I work with it every day and its not had that effect on me (at least I hope not)…

Sorry… it was childish… my apologies.

Kev

… and (GNU) AWK. Lovely language and by one of the two C inventors (Kernighan).

Still, “patriotic” is the wrong word. It’s more: bring home. Java is like the big brother of C++. I’d say Java is the natural step to a higher and much more efficent level. Like the step from Assembler to C/C++ has been (Assembler has been fun, but thanks, not again. :slight_smile:

Back to topic: I’ve read somewhere there are some (?) tools which allow your Java source to be “brought” to a system level like for example a Win32 system services dll. Unfortunately I don’t remember the details, but you didn’t need to convert your Java source to C++ or such, but compile your Java source to the final destination.
Maybe it’s been in the context of some IBM DB2 iterations? Don’t remember… :expressionless:

I believe Excelsior Jet can compile java code to a native dll. However that is not the path i really should take, i need to make c code which will be maintainable.

Thanks anyway!

Now there’s an oxymoron! ;D

Seriously, the best of luck to you. I don’t like having to dip into C/C++ land for anything these days, and was recently rather pleased to discover that a hardware dongle I have to interface with came with a little Java library to take care of the JNI hooks for me. Nice!

Naturally it’s really very ugly Java, as it is (quite literally) Java as written by C coders.