Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (494)
Games in Android Showcase (113)
games submitted by our members
Games in WIP (562)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Converting java source to c/c++ source  (Read 3349 times)
0 Members and 1 Guest are viewing this topic.
Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Posted 2003-11-26 23:54:02 »

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!
Offline shawnkendall

Senior Member





« Reply #1 - Posted 2003-11-27 01:09:09 »

just kill me ;-)

Shawn Kendall
Cosmic Interactive, LLC
http://www.facebook.com/BermudaDash
Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #2 - Posted 2003-11-27 01:40:00 »

Quote
just kill me ;-)


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 Sad
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline shawnkendall

Senior Member





« Reply #3 - Posted 2003-11-27 02:01:47 »

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 Sad

Yeah you have no choice it's true.  There are few Java to C++ programs out there.

Shawn Kendall
Cosmic Interactive, LLC
http://www.facebook.com/BermudaDash
Offline nonnus29

Senior Member




Giving Java a second chance after ludumdare fiasco


« Reply #4 - Posted 2003-11-27 15:11:27 »

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....  
Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #5 - Posted 2003-11-27 19:29:20 »

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.
Offline Jeff

JGO Coder




Got any cats?


« Reply #6 - Posted 2003-11-27 22:05:26 »

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


Welcome to hell, kid.

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

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #7 - Posted 2003-11-28 01:20:04 »

Quote
just pass everything by reference in your C++ code.  Going the other way can be bit trickier of course....  


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.

Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #8 - Posted 2003-11-28 01:35:15 »

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 Cry

Oh well, i will think of it as a C++ learinging exersize.... of PAIN Wink
Offline tortoise

Junior Member




<3 Shmups


« Reply #9 - Posted 2003-11-28 04:44:08 »

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.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Captain-Goatse

Junior Member




I suck at teh 2D. XBOX IS BIG LOL!111


« Reply #10 - Posted 2003-11-28 11:35:44 »

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!!"

Grin Grin Grin Grin Grin Grin
Offline Markus_Persson

JGO Wizard


Medals: 15
Projects: 19


Mojang Specifications


« Reply #11 - Posted 2003-11-28 11:52:30 »

Ooh, cool! A troll! =D

*hugs Captain-Goatse*

Play Minecraft!
Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #12 - Posted 2003-11-28 11:54:54 »

Quote
Also it will make you appreciate the beauty of multiple inheritance and pointers.
 Shocked

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.

Offline kevglass

JGO Kernel


Medals: 163
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #13 - Posted 2003-11-28 12:29:50 »

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

And captain-goaste, you're a tool. Smiley

Kev

Offline Captain-Goatse

Junior Member




I suck at teh 2D. XBOX IS BIG LOL!111


« Reply #14 - Posted 2003-11-28 14:25:36 »

Quote

 Shocked

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.


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
Offline Captain-Goatse

Junior Member




I suck at teh 2D. XBOX IS BIG LOL!111


« Reply #15 - Posted 2003-11-28 14:26:53 »

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

And captain-goaste, you're a tool. Smiley

Kev



Dude,

You are making fun of me and I do not know how =(
Perhaps C++ dumbed me down  Roll Eyes
Offline kevglass

JGO Kernel


Medals: 163
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #16 - Posted 2003-11-28 14:38:58 »

Perhaps Smiley

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

Offline Preston

Senior Member


Medals: 4



« Reply #17 - Posted 2003-11-28 16:34:56 »

Quote

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.


.. 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. :-)

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... :-|
Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #18 - Posted 2003-11-28 19:39:40 »

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!
Offline cfmdobbie

Senior Member


Medals: 1


Who, me?


« Reply #19 - Posted 2003-11-28 21:17:37 »

Now there's an oxymoron! Grin

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.

Hellomynameis Charlie Dobbie.
Offline Jeff

JGO Coder




Got any cats?


« Reply #20 - Posted 2003-11-29 01:00:02 »

A lesser known function of JNI is that it wil let you actually launch a VM and make method calls into it from C.

But im not sure you want all that overhead for a  plug-in, which is why I didn't mention it sooner.

JK

P.S.  I did 15 years of C and 10 years of C++ guys.  Yes, when you NEED "the world's highest level assembler" C is useful.  

The rest of the time its a royal fricking pain in the ass. i get working code written about 8 times faster in Java then I do in C Sad

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline Jeff

JGO Coder




Got any cats?


« Reply #21 - Posted 2003-11-29 01:35:33 »

Quote
HAHAHAHAHAHHA

Way to go Java mongers!!

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


<snipo>

 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.



Yeah!  Listen to the guy who only does C/C++ as oppsoed to those of us with lots of experience in both.  That makes sense.

Why are you even here CG?  I can't imagine these forums are of ANY use to you.

Fact of the matter is that those who have really learned Java after being very skilled C and C++ professionals have time after time reported 2 to 10 times productivity increases.  there are plenty of enterprise studies out there to supprot this if you wan't to actually do some google research.

FACT: Java promotes error that are late-errors in C and C++ (hiding til release) to compile time or first-run time errors.  This alone drastically reduces the error count released into the field and the Q&A time necessary to get to those releases.

FACT:  C++ suffers from the "fragile abse class" problem due to pre-compilation.  Java late binding solves this.

FACT: C++ requires you to do your own memory management and is generally horendously slow at allcoation and deallocation compared to Java. The result is pressure to write less object oriented and thus in the end less maintainable code.

There are other reasons but these are three of the big ones.

Take it from someone who was considered a C++ guru, who now does Java exclusively.


Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline Captain-Goatse

Junior Member




I suck at teh 2D. XBOX IS BIG LOL!111


« Reply #22 - Posted 2003-11-29 07:00:31 »

Quote



Yeah!  Listen to the guy who only does C/C++ as oppsoed to those of us with lots of experience in both.  That makes sense.

Why are you even here CG?  I can't imagine these forums are of ANY use to you.

Fact of the matter is that those who have really learned Java after being very skilled C and C++ professionals have time after time reported 2 to 10 times productivity increases.  there are plenty of enterprise studies out there to supprot this if you wan't to actually do some google research.

FACT: Java promotes error that are late-errors in C and C++ (hiding til release) to compile time or first-run time errors.  This alone drastically reduces the error count released into the field and the Q&A time necessary to get to those releases.

FACT:  C++ suffers from the "fragile abse class" problem due to pre-compilation.  Java late binding solves this.

FACT: C++ requires you to do your own memory management and is generally horendously slow at allcoation and deallocation compared to Java. The result is pressure to write less object oriented and thus in the end less maintainable code.

There are other reasons but these are three of the big ones.

Take it from someone who was considered a C++ guru, who now does Java exclusively.




Please read my other posts. I do quite a bit of lisp and ocaml. Even more than C++ now that I got my renderer finished and got to move into more interesting things.

Also please restraing from sprouting those "facts" as truims. They are not much better than someone saying Java is dumbed down C++.

20% increase in productivity? What is it just me or am I watching the infomercials channel here? Wait am I lazy? No. Your failure to provide "enterprise" studies is supported by the fact that I could not find any either.

http://www.zdnet.com.au/builder/program/development/story/0,2000035066,20277550,00.htm
is something.

Also, please if you find something let the source be something else than sun affiliated site. Java.sun.com affiliates promise to increase my productivity, get me a new boiler tank while I enhance my bust and penis size at the same time!!

Java is great. I admit it. I like the fact that you can write it once and run it anywhere. However I don't like the closed design of Java, which makes it almost impossible to incorporate it with my other projects written in other languages. Going using C from java is possible, but using Java from C is impossible. However I can use ocaml and lisp that way.Shocked

These forums are plenty of use for me. I don't like to be a closed minded C++er as you seem to make it out.

Roll Eyes x1000
Offline Captain-Goatse

Junior Member




I suck at teh 2D. XBOX IS BIG LOL!111


« Reply #23 - Posted 2003-11-29 07:02:39 »

Quote
A lesser known function of JNI is that it wil let you actually launch a VM and make method calls into it from C.

But im not sure you want all that overhead for a  plug-in, which is why I didn't mention it sooner.

JK

P.S.  I did 15 years of C and 10 years of C++ guys.  Yes, when you NEED "the world's highest level assembler" C is useful.  

The rest of the time its a royal fricking pain in the ass. i get working code written about 8 times faster in Java then I do in C Sad



Have you actually tried that?

I sure have. Yet it is incomplete and unstable and i'd rather claw my eyes out than use it.
Offline princec

JGO Kernel


Medals: 376
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #24 - Posted 2003-11-29 15:16:18 »

Worked all right for me.

Back on topic: a direct port from Java to C++ is probably not possible. It would be wise to determine the gist of the algorithm and write it from scratch. As someone Wink here said, you'd have it done by tomorrow if you just sat down and did it.

Cas Smiley

Offline Jeff

JGO Coder




Got any cats?


« Reply #25 - Posted 2003-11-29 17:11:19 »

Quote



Also please restraing from sprouting those "facts" as truims. They are not much better than someone saying Java is dumbed down C++.


Hmm that sounds familiar...

Quote


20% increase in productivity? What is it just me or am I watching the infomercials channel here?


How about some arguments rather then some insults?  Your assertions are sorely lacking ANY substantiative argument.  I gave you clearly identified and visible REASONS why Java is more productive.  You basically just ignored them and launched another barrage of empty insults.

And thats 200% to 1000%.  Read closer.  I sad 2 to 10 TIMES productivity.

Quote

Wait am I lazy? No. Your failure to provide "enterprise" studies is supported by the fact that I could not find any either.


I wouldn't say lazy, I'd say "google challenged."

First search I did (Java Productivity Study), first listing to pop up:
http://www.wellscs.com/robert/java/productivity.htm

This a very well researched and well established phenomenon,  despite your trolling comments.

Quote


Yes it is. Its yet ANOTHER productivity point I didn't mention.  (I told you tehre were more.)  Late binding allows much more freedom and ease of use when trying to create reusable libararies.  (Its something I alluded to in "fragile base class" but didn't really go into.)

Quote

Also, please if you find something let the source be something else than sun affiliated site. Java.sun.com affiliates promise to increase my productivity, get me a new boiler tank while I enhance my bust and penis size at the same time!!


Mature.

As I said before, if you find no value here why hang around?

Quote

Java is great. I admit it. I like the fact that you can write it once and run it anywhere. However I don't like the closed design of Java, which makes it almost impossible to incorporate it with my other projects written in other languages.


Plain wrong, there are over 100 other languages written for the Java VM.  If you cannot find the link googling, and I realize you are handy capped in that regard, let me know and I'll find that for you, too.

Quote

Going using C from java is possible, but using Java from C is impossible.


Wrong and ignorant.  Please read the artcle on JNI that comes with the VM. You can launch a VM from C.  You can call INTO a VM from C.


Quote

These forums are plenty of use for me. I don't like to be a closed minded C++er as you seem to make it out.


How? You started this by saying "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,"

How then is a site dedicated to Java programming of ANY use to you??  Other then a place to post trolling and ignorant assertions, that is.

[/quote]

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline Jeff

JGO Coder




Got any cats?


« Reply #26 - Posted 2003-11-29 17:22:48 »

Oh and I have to say, dude.  That that last quote of yours I quoted was almost unnecessary.

Its obvious to anyone who actually HAS done the Java transition, that you haven't yet or we wouldn't be having this discussion.  That 2 to 10 times figure I bandy about is based on hundreds of reports I've heard from hundreds of developers in my speaking and client contact capacities for Sun.

Ya know, not one has told me they were more productive in C/C++.  In fact they universally tell me Java has made them MUCH more productive.

Its obvious to anyone who does it, dude.  The one's who argue are the ones who don't want to.  (cf. Slashdot.)

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline Jeff

JGO Coder




Got any cats?


« Reply #27 - Posted 2003-11-29 17:26:42 »

Im going to ask Chris to lock this thread because there is clearly nothing more productive that can be said here.  The facts are there.  You can chose to ignore them.  But further trolling isn't going to elicit a response from me.

**plonk**

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #28 - Posted 2003-11-29 17:45:08 »

Quote

However I don't like the closed design of Java, which makes it almost impossible to incorporate it with my other projects written in other languages.


A truly ignorant statement from someone that obviously hasn't done any research.

I love the people that go on an don about Java being "closed" and "proprietary" - just silly.  Just because Sun decided not to hand over the future of Java to a standards body that Microsoft can bully (*cough*W3C*cough*).  The JCP becomes more "open" every day.  I certainly feel as a Java developer I have more of a chance of influencing the direction of Java than say C++ or .Net.

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Dwinin (15 views)
2014-09-12 09:08:26

Norakomi (45 views)
2014-09-10 13:57:51

TehJavaDev (57 views)
2014-09-10 06:39:09

Tekkerue (26 views)
2014-09-09 02:24:56

mitcheeb (49 views)
2014-09-08 06:06:29

BurntPizza (33 views)
2014-09-07 01:13:42

Longarmx (19 views)
2014-09-07 01:12:14

Longarmx (21 views)
2014-09-07 01:11:22

Longarmx (20 views)
2014-09-07 01:10:19

mitcheeb (30 views)
2014-09-04 23:08:59
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!