LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-07-2004, 08:08 AM   #1
dukehazord
LQ Newbie
 
Registered: Aug 2004
Location: Dublin
Posts: 3

Rep: Reputation: 0
I have Suse Linux 8.0 installed on my system & I don't know how to compile Java file?


I am using Suse Linux 8.0 for the first time and I have to make a porject using JavaScript. I need to know how do you compile and run .js files in Linux. Please.
 
Old 08-07-2004, 08:16 AM   #2
gearoid
Member
 
Registered: Nov 2003
Location: Ireland
Distribution: Red Hat 9
Posts: 49

Rep: Reputation: 15
pardon my ignorance but I didn't think you could actually compile javascript?! I thought it was just "magically" intrepreted by the browser or whatever. Run and intrepreted as a script, unlike heavier programming languages (like java say) that had to be compiled to be made into object code that could be understood by the platform / virtual machine...

I'm guessing I could be wrong...
 
Old 08-07-2004, 08:23 AM   #3
dukehazord
LQ Newbie
 
Registered: Aug 2004
Location: Dublin
Posts: 3

Original Poster
Rep: Reputation: 0
Java file compilation

You could be right. Could you then tell me please as if how to compile "Java" files in Linux.
 
Old 08-07-2004, 08:26 AM   #4
gearoid
Member
 
Registered: Nov 2003
Location: Ireland
Distribution: Red Hat 9
Posts: 49

Rep: Reputation: 15
from the shell, go to the directory that your files are in and type
Code:
javac *.java
to compile the files, and
Code:
java mainClassFileName
to run it. Just like you would from the dos promt on windows. Assuming you have a java compiler installed on your SuSE machine, and that it's included in your path that it...
 
Old 08-07-2004, 08:29 AM   #5
gearoid
Member
 
Registered: Nov 2003
Location: Ireland
Distribution: Red Hat 9
Posts: 49

Rep: Reputation: 15
actually - you might want to use the gcj command to comile the files - it's the GNU Java Compiler. Or try
Code:
gcj --help
for more info
 
Old 08-07-2004, 08:33 AM   #6
Ebel
Member
 
Registered: May 2004
Distribution: Slackware 10
Posts: 63

Rep: Reputation: 15
However before you can do the whole "javac file" thing you might have to download the SDK from Sun. You can get it here http://java.sun.com/j2se/1.3/download.html
 
Old 08-07-2004, 08:55 AM   #7
pravin_vin2003
LQ Newbie
 
Registered: Aug 2004
Location: india
Posts: 2

Rep: Reputation: 0
in java if u don't make ur main class public then u also compile & run
using different file name & class name.

##javac filename.java
##java classname

Last edited by pravin_vin2003; 08-07-2004 at 08:57 AM.
 
Old 08-07-2004, 09:05 AM   #8
pravin_vin2003
LQ Newbie
 
Registered: Aug 2004
Location: india
Posts: 2

Rep: Reputation: 0
i get a problem when i install my linux (RH-9) by removing logical partion of my hard drive of win-98 & now i don't get any detail about this partition when i use fdisk
command & if i format this partition during linux installation it didn't format
this partition so please help me to sort out this problem.
thanks if u help me.

Last edited by pravin_vin2003; 08-07-2004 at 09:06 AM.
 
Old 08-07-2004, 10:29 AM   #9
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Ubuntu/WSL
Posts: 9,788

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
dukehazord, you make a confusing question, the title was how to compile "java" file, while inside, it looks like you want to compile "javascript" (.js) and not "java" (.java) files.

Don't be fooled by the similar names, java and javascript are very different beasts, javascript was initially named "livescript", but was renamed "javascript" to benefit the hype around java at the begining of the Internet bubble time.

So, back to javascript, the company named Netscape who invent it used to compile javascript to kind of bytecode class file (livewire technology) but that was on the server side only, and I doubt is is used anymore today.

Since that time, there has been several open source projects around javascript, at least one of these allowing to compile javascript: rhino (http://www.mozilla.org/rhino/overview.html).

More generally, there is no reason for a language to be either only "interpreted" or only "compiled", it is IMHO always possible to write both an interpreter and an compiler for any programming language.
Not to mention Java, which first compile to a generic bytecode interpreted by a virtual machine that compile again parts of this bytecode on the fly to faster native CPU code ...

PS: pravin_vin2003, your posting is slightly off topic and in the wrong forum too I guess, my advice anyway is for you to restore your lost partition from your last backup ...

Last edited by jlliagre; 08-07-2004 at 10:34 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need to compile a Linux kernel so that it can use the FATX file system... Nebetsu Linux - Software 9 04-18-2005 11:10 AM
Help php compile javac or java system environment variable antony_csf Programming 1 06-16-2004 01:12 PM
Help php exec, system function for compile javac or java antony_csf Programming 0 06-15-2004 01:45 AM
How to make a image file for my disk( Including win2000&Redhat Linux system)? teradyne Linux - Software 3 06-02-2004 04:25 AM
Linux File System & Windows atko Linux - Newbie 3 02-07-2003 03:20 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration