Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Converting C++ to Java
New Posts  All Forums:Forum Nav:

Converting C++ to Java

post #1 of 7
Thread Starter 
I have John Conway's Game of Life written in C++ that I finished a while back. I now have to re-create this program in Java. Does anyone know of any way it would be easy to translate the code into Java? There is no GUI or anything, it is just a text output of the board. Thanks for any help!
600t SE Build
(13 items)
 
 
Laptop
(3 items)
 
CPUMotherboardGraphicsRAM
AMD Phenom II X6 1090T Asus Crosshair IV Formula 890FX XFX Radeon HD 6870 1GB [980/1200|1.25V] 8GB DDR3 1333 G.Skill RipJaw Series 
Hard DriveOSKeyboardPower
Mushkin 40GB SSD + 300GB WD VelociRaptor Windows 7 Razer Lycosa Corsair HX850 
CaseMouse
Corsair Graphite 600t SE Razer Deathadder 
CPUMotherboardGraphicsRAM
Athlon 64 X2 5000+ Black Edition Asus M2N-SLI Deluxe 8800GT in SLI OCZ Platinum Revision 2GB PC6400 DDR2 800 
OSPowerCase
Windows 7 Ultimate 64-bit OCZ GameXstream 700w Antec 900 
CPUGraphicsOS
Intel Core i5 NVS 3100M Windows 7 Professional 32-bit 
  hide details  
Reply
600t SE Build
(13 items)
 
 
Laptop
(3 items)
 
CPUMotherboardGraphicsRAM
AMD Phenom II X6 1090T Asus Crosshair IV Formula 890FX XFX Radeon HD 6870 1GB [980/1200|1.25V] 8GB DDR3 1333 G.Skill RipJaw Series 
Hard DriveOSKeyboardPower
Mushkin 40GB SSD + 300GB WD VelociRaptor Windows 7 Razer Lycosa Corsair HX850 
CaseMouse
Corsair Graphite 600t SE Razer Deathadder 
CPUMotherboardGraphicsRAM
Athlon 64 X2 5000+ Black Edition Asus M2N-SLI Deluxe 8800GT in SLI OCZ Platinum Revision 2GB PC6400 DDR2 800 
OSPowerCase
Windows 7 Ultimate 64-bit OCZ GameXstream 700w Antec 900 
CPUGraphicsOS
Intel Core i5 NVS 3100M Windows 7 Professional 32-bit 
  hide details  
Reply
post #2 of 7
After a few seconds of googling there looks to be a couple programs that claim they can do it it but no matter what human interaction will probably need to occur (and one of which was 120 dollars). I would suggest just converting it by hand using the C++ version as a guide to how the Java version could be set up. Sorry I cant be more help but I think the simplest solution would be to hand code it :/
Edited by ByteMyASCII - 10/24/11 at 9:08am
My System
(13 items)
 
  
CPUMotherboardGraphicsRAM
AMD Phenom II x4 955 ASUS Crosshair 3 EVGA 465GTX 1GB 8GB DDR3 1600mhz GSkill/ADATA 
Hard DriveOSMonitorKeyboard
40GB Intel SSD 1TB Western Digital Black Edition Windows 7 x64 Pro Dual 21.5 Sceptre Saitek Eclipse 
PowerCaseMouseMouse Pad
850watt Silverstone Element Coolermaster Haf 932 Razer Lachesis Razer Vespula 
  hide details  
Reply
My System
(13 items)
 
  
CPUMotherboardGraphicsRAM
AMD Phenom II x4 955 ASUS Crosshair 3 EVGA 465GTX 1GB 8GB DDR3 1600mhz GSkill/ADATA 
Hard DriveOSMonitorKeyboard
40GB Intel SSD 1TB Western Digital Black Edition Windows 7 x64 Pro Dual 21.5 Sceptre Saitek Eclipse 
PowerCaseMouseMouse Pad
850watt Silverstone Element Coolermaster Haf 932 Razer Lachesis Razer Vespula 
  hide details  
Reply
post #3 of 7
If you wrote it yourself in C++ and understood what you were writing then converting it to java should be simple enough. Java and c++ are very similar languages.

I doubt there are any programs that could rewrite the code into another language for you, the best you're likely to find if a wrapper that will run c++ programs within a java wrapper.
Foldatron
(17 items)
 
Mat
(10 items)
 
Work iMac
(9 items)
 
CPUMotherboardGraphicsGraphics
i7 950 EVGA x58 3-way SLI EVGA GTX 660ti GTX 275 
RAMHard DriveHard DriveHard Drive
3x2GB Corsair Dominator DDR3-1600 80GB Intel X25-M SSD 2TB WD Black 150GB WD Raptor 
Hard DriveOSMonitorKeyboard
2x 150GB WD V-raptor in RAID0 Win7 Home 64-bit OEM 55" LED 120hz 1080p Vizio MS Natural Ergonomic Keyboard 4000 
PowerCase
750W PC P&C Silencer CoolerMaster 690 
CPUGraphicsRAMHard Drive
Intel Core i5 2500S AMD 6770M 8GB (2x4GB) at 1333Mhz 1TB, 7200 rpm 
Optical DriveOSMonitorKeyboard
LG 8X Dual-Layer "SuperDrive" OS X Lion 27" iMac screen Mac wireless keyboard 
Mouse
Mac wireless mouse 
CPUGraphicsRAMHard Drive
i7-2600K AMD 6970M 1GB 16GB PC3-10600 DDR3 1TB 7200rpm 
Hard DriveOptical DriveOSMonitor
256GB SSD 8x DL "SuperDrive" OS X 10.7 Lion 27" 2560x1440 iMac display 
Monitor
27" Apple thunderbolt display 
  hide details  
Reply
Foldatron
(17 items)
 
Mat
(10 items)
 
Work iMac
(9 items)
 
CPUMotherboardGraphicsGraphics
i7 950 EVGA x58 3-way SLI EVGA GTX 660ti GTX 275 
RAMHard DriveHard DriveHard Drive
3x2GB Corsair Dominator DDR3-1600 80GB Intel X25-M SSD 2TB WD Black 150GB WD Raptor 
Hard DriveOSMonitorKeyboard
2x 150GB WD V-raptor in RAID0 Win7 Home 64-bit OEM 55" LED 120hz 1080p Vizio MS Natural Ergonomic Keyboard 4000 
PowerCase
750W PC P&C Silencer CoolerMaster 690 
CPUGraphicsRAMHard Drive
Intel Core i5 2500S AMD 6770M 8GB (2x4GB) at 1333Mhz 1TB, 7200 rpm 
Optical DriveOSMonitorKeyboard
LG 8X Dual-Layer "SuperDrive" OS X Lion 27" iMac screen Mac wireless keyboard 
Mouse
Mac wireless mouse 
CPUGraphicsRAMHard Drive
i7-2600K AMD 6970M 1GB 16GB PC3-10600 DDR3 1TB 7200rpm 
Hard DriveOptical DriveOSMonitor
256GB SSD 8x DL "SuperDrive" OS X 10.7 Lion 27" 2560x1440 iMac display 
Monitor
27" Apple thunderbolt display 
  hide details  
Reply
post #4 of 7
If you're not willing to port it completely in c++, then I believe running it the other way around is going to be hard if you want to wrap it. I remember when I worked dealing with C++ code that needed to be ran in a Java env. It required learning about the JNI (java native interface). You have to implement everything perfectly otherwise you're going to have tons of issues and debugging isn't all that easy.

The project was so complex that we had to drop it. It CAN be done though. It's just a PITA and you'll need some pretty diligent programmers.
Mr Jiggawatts
(13 items)
 
  
CPUMotherboardGraphicsRAM
1090T@4GHz@1.46V Ultra LLC/3GHz CPU-NB@1.33V Asus Crosshair V Formula MSI GTX560-TI 1GB TF II Patriot Viper Xtreme 1600 8GB (2x4GB) 8-9-8-24 
Hard DriveOSMonitorKeyboard
Intel X25-V 40GB, Kingston SSDNow 64GB Windows 7 Ultimate LG Flatron W2353V Razer Arctosa 
PowerCaseMouse
Antec HCG-900W Antec Lanboy Air Yellow Razer Abbysus 
  hide details  
Reply
Mr Jiggawatts
(13 items)
 
  
CPUMotherboardGraphicsRAM
1090T@4GHz@1.46V Ultra LLC/3GHz CPU-NB@1.33V Asus Crosshair V Formula MSI GTX560-TI 1GB TF II Patriot Viper Xtreme 1600 8GB (2x4GB) 8-9-8-24 
Hard DriveOSMonitorKeyboard
Intel X25-V 40GB, Kingston SSDNow 64GB Windows 7 Ultimate LG Flatron W2353V Razer Arctosa 
PowerCaseMouse
Antec HCG-900W Antec Lanboy Air Yellow Razer Abbysus 
  hide details  
Reply
post #5 of 7
well if you understand both languages very well lets say if you used cout "yeah" find the java command that does the same it might help i port stuff from c to c++ c++ to basic basic to c php to ??
My computer
(18 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core 2 Duo E6600 DG965SS powercolor 6670   
RAMHard DriveOptical DriveCooling
G.Skill Seagate  DVD WRITER heat sink + fan 
OSOSOSMonitor
Windows 7 Windows XP Linux Ubuntu FLATRON L1740B 
KeyboardPowerCaseMouse
Microsoft Basic 500 WATT PSU TOWER Microsoft Basic 
AudioOther
IDT intergrated AUDIO 5.1 speakers 
  hide details  
Reply
My computer
(18 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core 2 Duo E6600 DG965SS powercolor 6670   
RAMHard DriveOptical DriveCooling
G.Skill Seagate  DVD WRITER heat sink + fan 
OSOSOSMonitor
Windows 7 Windows XP Linux Ubuntu FLATRON L1740B 
KeyboardPowerCaseMouse
Microsoft Basic 500 WATT PSU TOWER Microsoft Basic 
AudioOther
IDT intergrated AUDIO 5.1 speakers 
  hide details  
Reply
post #6 of 7
Its not that hard, if you know either language (or any c-based language for that matter). Convert it yourself.
    
CPUMotherboardGraphicsGraphics
FX-8350 Asus Crosshair V MSI GTX460 Hawk 1gb MSI GTX460 Hawk 1gb 
RAMHard DriveHard DriveHard Drive
Kingston HyperX 8gb (2x4gb) Crucial M4 64GB Samsung F3 1TB Western Digital 320GB 
CoolingOSMonitorMonitor
Custom WC Windows 7 Ultimate X64 Dell E2311H Dell E2311H 
MonitorKeyboardPowerCase
LH 23EN43 Ducky Year of the Dragon 2012 SilverStone Strider 1000W-P Corsair 800D 
Audio
Asus Xonar Essence STX 
  hide details  
Reply
    
CPUMotherboardGraphicsGraphics
FX-8350 Asus Crosshair V MSI GTX460 Hawk 1gb MSI GTX460 Hawk 1gb 
RAMHard DriveHard DriveHard Drive
Kingston HyperX 8gb (2x4gb) Crucial M4 64GB Samsung F3 1TB Western Digital 320GB 
CoolingOSMonitorMonitor
Custom WC Windows 7 Ultimate X64 Dell E2311H Dell E2311H 
MonitorKeyboardPowerCase
LH 23EN43 Ducky Year of the Dragon 2012 SilverStone Strider 1000W-P Corsair 800D 
Audio
Asus Xonar Essence STX 
  hide details  
Reply
post #7 of 7
In addition, you have the luxuries of Java garbage collection so it may actually be easier. wink.gif

Java has tons of facilities to make your life much easier.

Good luck.
Mr Jiggawatts
(13 items)
 
  
CPUMotherboardGraphicsRAM
1090T@4GHz@1.46V Ultra LLC/3GHz CPU-NB@1.33V Asus Crosshair V Formula MSI GTX560-TI 1GB TF II Patriot Viper Xtreme 1600 8GB (2x4GB) 8-9-8-24 
Hard DriveOSMonitorKeyboard
Intel X25-V 40GB, Kingston SSDNow 64GB Windows 7 Ultimate LG Flatron W2353V Razer Arctosa 
PowerCaseMouse
Antec HCG-900W Antec Lanboy Air Yellow Razer Abbysus 
  hide details  
Reply
Mr Jiggawatts
(13 items)
 
  
CPUMotherboardGraphicsRAM
1090T@4GHz@1.46V Ultra LLC/3GHz CPU-NB@1.33V Asus Crosshair V Formula MSI GTX560-TI 1GB TF II Patriot Viper Xtreme 1600 8GB (2x4GB) 8-9-8-24 
Hard DriveOSMonitorKeyboard
Intel X25-V 40GB, Kingston SSDNow 64GB Windows 7 Ultimate LG Flatron W2353V Razer Arctosa 
PowerCaseMouse
Antec HCG-900W Antec Lanboy Air Yellow Razer Abbysus 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Converting C++ to Java