[I'm guessing] You need to 'have' java run it (not the shell).
http://stackoverflow.com/questions/1...ckage-from-cmd
Not the best link, but I'm not 'into' java/GUI,
so I welcome another LQ'er to explain this better!
**Also, read/study:
http://wikipedia.org/wiki/Shebang_(Unix)
Code:
# head -1 MyWorld.class
▒▒▒▒3G
Note that: this/any? .class file is binary, not text, so no #!... first line!
The Unix `file` command/concept comes to mind; here's some .... [
junk]
(again, I don't have java installed in this CLI-only VBox VirtualMachine)
[CODE]
root@trisquel:~# find / -xdev -name \*.class | head -1
/usr/share/nmap/nselib/data/jdwp-class/JDWPExecCmd.class
root@trisquel:~# cp /usr/share/nmap/nselib/data/jdwp-class/JDWPExecCmd.class MyWorld.class
root@trisquel:~#
root@trisquel:~# chmod 755 MyWorld.class #<<<NOT needed/appropriate; just to demo error here!
root@trisquel:~# ./MyWorld.class
bash: ./MyWorld.class: cannot execute binary file: Exec format error
root@trisquel:~#
root@trisquel:~# file MyWorld.class
MyWorld.class: compiled Java class data, version 51.0
root@trisquel:~# file /bin/ls
/bin/ls: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=cecbb9e27978d91bc6fe2cc4d46d0cd58deafdb2, stripped
root@trisquel:~# file `which update-grub`
/usr/sbin/update-grub: POSIX shell script, ASCII text executable
root@trisquel:~#
[/CODE]
p.s. does Linux 'know' how to run a .cpp file?
Yes? Cool!
No? I wonder what **exactly** OP p\_/ppy did...
p.p.s. PLEASE use: CODE ...YourStuff... /CODE '
tags' (note the square-brackets!)
Looks a **lot** nicer, yes? (you can use the 'Edit' button, to fix your posts)
Code:
root@trisquel:~# find / -xdev -name \*.class | head -1
/usr/share/nmap/nselib/data/jdwp-class/JDWPExecCmd.class
root@trisquel:~# cp /usr/share/nmap/nselib/data/jdwp-class/JDWPExecCmd.class MyWorld.class
root@trisquel:~#
root@trisquel:~# chmod 755 MyWorld.class #<<<NOT needed/appropriate; just to demo error here!
root@trisquel:~# ./MyWorld.class
bash: ./MyWorld.class: cannot execute binary file: Exec format error
root@trisquel:~#
root@trisquel:~# file MyWorld.class
MyWorld.class: compiled Java class data, version 51.0
root@trisquel:~# file /bin/ls
/bin/ls: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=cecbb9e27978d91bc6fe2cc4d46d0cd58deafdb2, stripped
root@trisquel:~# file `which update-grub`
/usr/sbin/update-grub: POSIX shell script, ASCII text executable
root@trisquel:~#
p.p.p.s.: My web-research of the day: .pdf c++ java linux run*
Whoa! 955,000links, 500pages each! ...Back in a few
years
Or, in a few days:
http://horstmann.com/ccc/c_to_java.pdf or
this