Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #27889 > unrolled thread

Will Java compiled in windows work in Linux?

Started by"D. Xenakis" <sparkdevelopment.social@gmail.com>
First post2014-03-27 10:50 -0700
Last post2014-03-28 00:16 -0700
Articles 6 — 5 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  Will Java compiled in windows work in Linux? "D. Xenakis" <sparkdevelopment.social@gmail.com> - 2014-03-27 10:50 -0700
    Re: Will Java compiled in windows work in Linux? Marcel Müller <news.5.maazl@spamgourmet.org> - 2014-03-27 19:15 +0100
    Re: Will Java compiled in windows work in Linux? Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-03-27 14:58 -0400
      Re: Will Java compiled in windows work in Linux? "D. Xenakis" <sparkdevelopment.social@gmail.com> - 2014-03-27 13:04 -0700
      Re: Will Java compiled in windows work in Linux? Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2014-03-27 23:31 +0200
    Re: Will Java compiled in windows work in Linux? Roedy Green <see_website@mindprod.com.invalid> - 2014-03-28 00:16 -0700

#27889 — Will Java compiled in windows work in Linux?

From"D. Xenakis" <sparkdevelopment.social@gmail.com>
Date2014-03-27 10:50 -0700
SubjectWill Java compiled in windows work in Linux?
Message-ID<d2e8d0cd-57cc-4467-99f9-c20523f08238@googlegroups.com>
I have installed on my host linux server online the following file: "traccar-linux-64-2.7.zip (26-Jan-2014)" downloaded from the following link (http://www.traccar.org/download.jsp)

First question: If i want to compile from scratch on my machine using their source code unmodificated from here (http://www.traccar.org/source.jsp), would the new generated traccar.run file, have the same hash with "traccar-linux-64-2.7.zip (26-Jan-2014)" ? I mean are they going to be identical?

Second question: Should i compile this through a linux environment? For example Ubuntu, or can i do the compile from Windows environment too? For example windows 8.1 ?

[toc] | [next] | [standalone]


#27890

FromMarcel Müller <news.5.maazl@spamgourmet.org>
Date2014-03-27 19:15 +0100
Message-ID<53346abc$0$4217$9b4e6d93@newsspool2.arcor-online.net>
In reply to#27889
To your subject: yes. (BTDT)
The java byte code is platform independent.
Only JNI code is platform dependent.

But I am not familiar with traccar.


Marcel

[toc] | [prev] | [next] | [standalone]


#27891

FromEric Sosman <esosman@comcast-dot-net.invalid>
Date2014-03-27 14:58 -0400
Message-ID<lh1scl$vp0$1@dont-email.me>
In reply to#27889
On 3/27/2014 1:50 PM, D. Xenakis wrote:
> I have installed on my host linux server online the following file: "traccar-linux-64-2.7.zip (26-Jan-2014)" downloaded from the following link (http://www.traccar.org/download.jsp)
>
> First question: If i want to compile from scratch on my machine using their source code unmodificated from here (http://www.traccar.org/source.jsp), would the new generated traccar.run file, have the same hash with "traccar-linux-64-2.7.zip (26-Jan-2014)" ? I mean are they going to be identical?

     Possibly not.  If you compile with a different Java version
than they used, the class file format's version number might be
different.  If you use different compiler options than they did,
the class files may contain different kinds and amounts of debugging
information.  Even if the class files are identical, the archive's
hash code may be different if you used a different ZIP utility.

     The "payload" in the class files should be identical (barring
severe version skew), but you'll need something more context-aware
than a full-file checksum.

> Second question: Should i compile this through a linux environment? For example Ubuntu, or can i do the compile from Windows environment too? For example windows 8.1 ?

     If the code is entirely in Java, it'll be "the same" (see above)
no matter what environment it's compiled on.  If there's any native
(non-Java) code, or if the archive includes things like installers
and such, all bets are off.

-- 
Eric Sosman
esosman@comcast-dot-net.invalid

[toc] | [prev] | [next] | [standalone]


#27892

From"D. Xenakis" <sparkdevelopment.social@gmail.com>
Date2014-03-27 13:04 -0700
Message-ID<c6a5dabc-b1b8-4b5e-ae7c-8e610e5f2ccb@googlegroups.com>
In reply to#27891
thx very much

[toc] | [prev] | [next] | [standalone]


#27893

FromJukka Lahtinen <jtfjdehf@hotmail.com.invalid>
Date2014-03-27 23:31 +0200
Message-ID<lvsiq3coqo.fsf@saunalahti.fi>
In reply to#27891
Eric Sosman <esosman@comcast-dot-net.invalid> writes:
> On 3/27/2014 1:50 PM, D. Xenakis wrote:

>> First question: If i want to compile from scratch on my machine using
>> their source code unmodificated from here
>> (http://www.traccar.org/source.jsp), would the new generated traccar.run
>> file, have the same hash with "traccar-linux-64-2.7.zip (26-Jan-2014)" ?

>     Possibly not.  If you compile with a different Java version
> than they used, the class file format's version number might be
> different.  If you use different compiler options than they did,
> the class files may contain different kinds and amounts of debugging
> information.  Even if the class files are identical, the archive's
> hash code may be different if you used a different ZIP utility.

I would say they almost certainly have different hash codes.
The zip file format includes not only the contents of each file packed
in the zip, but also the timestamps of each file, and they WILL be
different when you re-compile the classes, even with an identical
computer with identical operating system, jdk and all possible options.

But because a hash code doesn't contain ALL the information of
the file, there is a slight possibility that they might still happen to
have the same hash code.

-- 
Jukka Lahtinen

[toc] | [prev] | [next] | [standalone]


#27894

FromRoedy Green <see_website@mindprod.com.invalid>
Date2014-03-28 00:16 -0700
Message-ID<798aj9191pe3v9nq3aht825vtvn5pv6hce@4ax.com>
In reply to#27889
On Thu, 27 Mar 2014 10:50:48 -0700 (PDT), "D. Xenakis"
<sparkdevelopment.social@gmail.com> wrote, quoted or indirectly quoted
someone who said :


Java sacrifices quite a bit to be WORA -- run anywhere with the same
Jar unmodified.

If a Java program hard coded in some file names, they might not work
in unix. Ditto presumptions about crlf or default encodings.

If you compile with 1.8, you must run with 1.8 unless you used
-target.

-- 
Roedy Green Canadian Mind Products http://mindprod.com
"A great lathe operator commands several times the wage of an average lathe
operator, but a great writer of software code is worth 10,000 times the
price of an average software writer."
~ Bill Gates

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web