Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail From: BGB Newsgroups: comp.lang.java.programmer Subject: Re: =?UTF-8?B?QW5kcm9pZO+/vVdoeSBEYWx2aWs/?= Date: Thu, 02 Jun 2011 03:32:43 -0700 Organization: albasani.net Lines: 83 Message-ID: References: <71meu69511266d561jhov9a8d16d4ko77v@4ax.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: news.albasani.net HvQiApA/uQhvggmtt7dzeN5jYmuoil39e72AbbUkbTdHfZ6ed+op2hFMuAp6kh+70ODmCbwLAXl8ojpHuIlgHw== NNTP-Posting-Date: Thu, 2 Jun 2011 10:35:50 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="goS8ONLVLb3N4eBgMS4LEO2hazVTBXwuyflfdeI/BPad8ddNEJlal3DZz82h4wyG9qWNSlfWCt3v86lf2T5WCk95XfBmd2jS6ELYA/dZNCYR5w4rOSZqpDa9FdZU1kTE"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 In-Reply-To: <71meu69511266d561jhov9a8d16d4ko77v@4ax.com> Cancel-Lock: sha1:7Vywzb+Oc8TIGQbNIEvro4dHMG4= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:4883 On 6/2/2011 2:35 AM, rossum wrote: > On Thu, 02 Jun 2011 11:54:06 +1200, Lawrence D'Oliveiro > wrote: > >> In message, Joshua Cranmer wrote: >> >>> On 05/31/2011 11:05 PM, Lawrence D'Oliveiro wrote: >>> >>> Funny. I thought C/C++ was supposed to be portable. >> >> C certainly is. “Write once, run everywhere” is more true of C than it is of >> Java; a portable compiler like GCC means C is the most portable language in >> the world. >> >>> With Java, it doesn't matter which compiler I use to link the binary, they >>> all the do same thing. Even if I don't program my code in Java. ;-) >>> >>> Java has extreme ABI portability--any compiler, any OS, any arch. >> >> At the cost of putting the burden on the recipient of your code to figure >> out how to run a .jar file on their system. > To run a .jar file on my system I double click on the file. I can run > a C program using the GCC compiler as well but it is a lot more > trouble than a double click. > > On my system a .jar file is immediately runnable while a C source file > isn't. C is not "write once run everywhere" it is "write once, > compile and run everywhere." Java removes the compile step from the > user's end. > > To me the .jar is more portable. > yes, but to be fair though, it is a little less convenient in some cases than a native binary would be, such as (AFAIK) on Linux it would be necessary to use a shell script to wrap the call to 'java' to make it behave more like a native program (from the shell, GNome does file associations so will probably wrap this case). say, "myprogram.sh": java -jar myprogram.jar ... I just did a little experiment here, and it seems on modern Windows (Win7) one can essentially launch files (jars included) directly from the command-line (presumably arguments would be passed to the JVM and be parsed correctly, but I didn't test this...). I suspect this is because the CMD shell now checks for associations and launches the program. AFAICT, it one goes and adds JAR to the PATHEXT environment variable, then it is no longer necessary to include typing the jar file extension when launching JARs. one could do similar with C files, but alas then this would hinder their more useful behavior: double-click to launch ones' favorite text editor... well, and as well, C programs are not typically self-contained in a single source file, so one would more likely need a Makefile-like launcher script of some sort... then this made me wonder about something... apparently it seems EXE files do have file associations in the registry... odd... then again, I do remember an instance of someone going and messing with file associations to break Windows in a relatively amusing way (pretty much nothing could be done on the computer, because nearly all actions resulted in Notepad windows filled with binary garbage). it does bring up an idle mystery though as to how much of a central role the OS's binary format really needs in an OS, or if it could be largely reduced to "just another file format" as far as the kernel is concerned (all files launched by associations, including program binaries, just with a little bit of a hack for the "main program loader" or similar, with the OS possibly allowing secondary loaders with a behavior analogous to that of the main loader). or such...