Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (489)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (555)
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  
  Reply to Tortoise in Java vs C++  (Read 2840 times)
0 Members and 1 Guest are viewing this topic.
Offline hksduhksdu

Junior Newbie




Linux + Java = Perfect


« Posted 2003-08-14 17:40:00 »

Perhaps Admin. made it read only so I cannot reply your post.  I am no offense, but isn't that byte code interpretted into machine code?  .class is byte code, and when you run .class files, they are interpretted into machine code on the fly to memory.  You don't compile on the fly because it's not a script language.  The process you do to *transform* from .java to .class is called compile, the process the JVM *translate* from .class to machine code is called Interpret.

Correct me if I am wrong.

Wink
Offline tortoise

Junior Member




<3 Shmups


« Reply #1 - Posted 2003-08-14 18:22:36 »

I was just being a bit nitpicky, but there is a difference between compiling and interpreting. If you're changing from one language to another that's (generally) compiling. If you're looking at the language and reacting to what it says, that's interpreting. Modern JVMs take the bytecode and compile it to machine code. Similiar to how a traditional compiler for say C does, except it's being done on the fly.

Java bytecode may not be a human readable language, but it's still a language. They're not machine code, so they have to either be interpreted (old JMVs) or compiled to machine code and let the computer interpret the machine code.
Offline hksduhksdu

Junior Newbie




Linux + Java = Perfect


« Reply #2 - Posted 2003-08-18 09:21:40 »

As far as I studied from University also Java Certification from Sun, Java compiles plain english into bytecode, then translates into machine code on the fly.  You will never compile on the fly because compile is not an execution of commands.  The JVM is to interpret, which is translating, from bytecode to machine language and execute the commands.  If you compile on the fly, where do you get the compile error?  If you get an error when you run a program, it's called run-time error.  From this, you can imply that compiling is to compile plain english into bytecode, and translating(interpretting) bytecode into machine code on the fly.

Wink
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline princec

JGO Kernel


Medals: 368
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #3 - Posted 2003-08-18 10:05:30 »

To, er, avoid any further "interesting" interpretations of what "compile" and "interpret" mean with respect to running software I'd just like to chime in:

Interpreted languages use an interpreter which reads a sequence of non-hardware-native instructions and calls subroutines to execute each instruction. Machine code is actually interpreted by the CPU.

Compiled languages convert from one language into another language. This can mean compiling from Java to C, or from Java to bytecode, or from bytecode to machine code.

Machine code is an interpreted language; it's interpreted by hardware, is the only difference. Quite often these days it's even further compiled internally in the CPU into microcode which is even lower level than machine code and subsequently even faster when it's read from a cache.

The Java Compiler is just that - it compiles the Java language into bytecode.

The Hotspot Virtual Machine is a hybrid interpreter and compiler. It performs honest-to-goodness interpretation of Java bytecode and calls machine code subroutines to execute byte code. After a little while it decides that some bits are best compiled, and it subsequently compiles the bytecode directly into machine code and caches it, shifting the onus of interpretation directly onto the CPU.

Why this is still a subject of debate is baffling, unless it's some language quirk in non-native English speakers that's causing an unforeseen confusion.

Cas Smiley

Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #4 - Posted 2003-08-18 10:06:19 »

To my understanding, interpretting is translating and executing instructions on the fly, and repeat doing that everytime the instructions are encountered.
A JVM usually interprets the bytecode until they are encountered a number of times. When they have been encountered a number of times, the JVM compiles that part to native machine code on the fly so that it doesn't have to interpret them the next time.
This is called mixed mode execution (both interpretting and compiling).
That period in the programs execution is typically referred as 'start up time' or 'warming up'.
After 'warming up' the important parts have been compiled to native machine code and no (or almost no) interpretting is done anymore by the JVM.
The reason you don't get compiler errors during execution is because javac catches them before the code is run.

Somebody correct me if I'm wrong.

<edit>ah, Cas beat me to it with a much better explanation  Roll Eyes </edit>

Offline tortoise

Junior Member




<3 Shmups


« Reply #5 - Posted 2003-08-18 13:33:33 »

Quote
To, er, avoid any further "interesting" interpretations of what "compile" and "interpret" mean with respect to running software I'd just like to chime in:


errr, ok. and I said...

"If you're changing from one language to another that's (generally) compiling. If you're looking at the language and reacting to what it says, that's interpreting."

"...and let the computer interpret the machine code."

Perhaps a tad on the vague side, but not incorrect nor "interesting".
Offline princec

JGO Kernel


Medals: 368
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #6 - Posted 2003-08-18 13:37:38 »

Yeah, not you specifically, but these threads are remarkable for popping up now and again and going over the same-old-same-old that should have been put to rest about 4 years ago. (That's why it got stomped on by the mod)

Cas Smiley

Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #7 - Posted 2003-08-19 07:43:41 »

Quote
Yeah, not you specifically, but these threads are remarkable for popping up now and again and going over the same-old-same-old that should have been put to rest about 4 years ago. (That's why it got stomped on by the mod)


So I wonder, when are those pointless code formatting discussions finally get stomped on? Roll Eyes
At least the C++ vs. Java discussions are still somewhat valid and current (the C++ vs Java discussion even took place in a recent JDJ article  Wink) and these aot compiling vs. jit vs. interpretting vs. mixed mode issues are still likely to cause confusion.

Offline Breakfast

Senior Member




for great justice!


« Reply #8 - Posted 2003-08-19 18:56:56 »

Well, the issues may cause confusion, but they probably don't need to be repeated again and again and again here and over at the jdc forums and every time Slashdot mentions java and that's just the ones I occasionally visit.

Most forums have a "search old threads" facility and I like to think they exist for a reason, it just gets tiresome to see the same old issues dragged up time and time again by new generations of the lazy and ignorant who can't be bothered to check whether their question has been answered before. Then again, I suppose that is like a microcosm of human history, so I guess its unlikely to change any time soon  Wink
Offline princec

JGO Kernel


Medals: 368
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #9 - Posted 2003-08-19 19:05:30 »

(quick aside on that search idea)
Nearly all forums exist for the moment, with things becoming relevant then fading into obscurity all the time.
Generally speaking the search functions on flat forums, like this one, are useless. They often don't find good results; they often find irrelevant results; they usually find stuff that's actually out of date anyway.

That's why these things keep surfacing.

Without a nice threaded GUI and proper moderation flat forums are of limited use but they're the best thing we generally have on the web. Lowest common denominator and all.

Cas Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline cfmdobbie

Senior Member


Medals: 1


Who, me?


« Reply #10 - Posted 2003-08-19 19:18:31 »

Hmm, so what we need is a way of archiving discussions in prose form, preferably with no moderator intervention.  Once it starts getting full it would become a useful archive for new users to peruse.

If we could get something like that, it'd be WIKId. Tongue

Hellomynameis Charlie Dobbie.
Offline troggan

Junior Member




no guts no glory


« Reply #11 - Posted 2003-08-20 05:31:57 »

You mean something like this
http://wiki.java.net/bin/view/Games/WhatMeansCompileAndInterpret
Smiley ?

(http://www.wannawork.de) - Will work for food
(http://tvbrowser.org) - Java EPG
Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #12 - Posted 2003-08-20 06:10:14 »

Heh, that's nice  Smiley
Of course this won't prevent these discussions from popping up every now and then, but they can be put to rest quickly by pointing them to such a link.

Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #13 - Posted 2003-08-28 15:50:39 »

Quote

Generally speaking the search functions on flat forums, like this one, are useless. They often don't find good results; they often find irrelevant results; they usually find stuff that's actually out of date anyway.

That's why these things keep surfacing.

Without a nice threaded GUI and proper moderation flat forums are of limited use but they're the best thing we generally have on the web.


Perhaps we should upgrade to gossamer threads (GT) Forum or similar? I'm not raving about GT at the moment, but we're adopting it for a game at the moment precisely because it does things like threaded discussions (and some other features that aren't really relevant to this discussion...).

www.gossamer-threads.com

malloc will be first against the wall when the revolution comes...
Offline cfmdobbie

Senior Member


Medals: 1


Who, me?


« Reply #14 - Posted 2003-08-28 19:18:14 »

Arrgh!  Not another "new forum software" thread... Grin

Roll Eyes

Hellomynameis Charlie Dobbie.
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.

Nickropheliac (13 views)
2014-08-31 22:59:12

TehJavaDev (23 views)
2014-08-28 18:26:30

CopyableCougar4 (27 views)
2014-08-22 19:31:30

atombrot (40 views)
2014-08-19 09:29:53

Tekkerue (38 views)
2014-08-16 06:45:27

Tekkerue (34 views)
2014-08-16 06:22:17

Tekkerue (24 views)
2014-08-16 06:20:21

Tekkerue (34 views)
2014-08-16 06:12:11

Rayexar (72 views)
2014-08-11 02:49:23

BurntPizza (47 views)
2014-08-09 21:09:32
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!