Jump to content

  • Log In with Google      Sign In   
  • Create Account

Languages


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
15 replies to this topic

#1 HelloSkitty   Members   -  Reputation: 152

Like
0Likes
Like

Posted 29 June 2011 - 12:21 PM

So I'm already familiar with Java and C++, and I know there are a lot of other languages used to program games (python, etc.) But I've never been able to figure out how to actually run these programs without some kind of installation (java->eclipse, cpp->visual cpp). Even so, one of my computers lacks javac in command prompt, yet it can run an embedded java applet on a webpage. I doubt it has cmake, yet I found a piece of software in c++ that ran fine on my computer. So my main question is, how is it done?

Being able to run code without anything installed has always been something I've been looking for (do NOT tell me to write a compiler). So I've been learning batch for a few days until I found out it's a scripting language, and not a programming language. Assembly is apparently the most basic language, and I'd gladly learn it if I could figure out how to run it.

So are there any really low level languages that games are programmable in (by low level, I mean no compile software installation required, just write code in notepad, and run)? Complexity of the code is not really an issue for me, (I'm probably going to regret saying that when someone says to use assembly to write pong), so much as ease of running, and runtime quickness.

Edit: Resolved. Didn't feel like bumping, so I put here. Thanks to all for explaining how compiling works, and thanks to rip-off, I'll look into portable JRE, that was actually exactly what I was trying to find!
A penny for my thoughts? Do you think I have only half a brain?

Not-so-proud owner of blog: http://agathokakologicalartolater.wordpress.com/

Sponsor:

#2 mhagain   Crossbones+   -  Reputation: 7979

Like
0Likes
Like

Posted 29 June 2011 - 12:34 PM

Generally, "no".

You can't just write code in a text editor and run it, even a batch file scripting language needs some kind of interpreter behind it (which may or may not be built in to the OS). What you can do is compile code to an executable and then distribute that executable; other people will be able to run it without needing the build environment installed (assuming that it compiles to a native executable - Java/C# typically don't for example, whereas C or C++ typically do).

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#3 A Brain in a Vat   Members   -  Reputation: 313

Like
1Likes
Like

Posted 29 June 2011 - 12:42 PM

You're conflating lots of different concepts.

Installation vs Non-installation:
Some applications require an installation. This means the executable you download and run to install the application is not actually the application -- though it contains it (or somehow fetches it). The installer puts files where they need to be. It may put the application in C:\Program Files(x86)\, or it might let you choose where to put it. It might have to put shared libraries in the right places, or it might have to modify the registry in some way.

Other applications are written to be entirely self-contained and stand-alone. In that case the executable you download and run is the application. You can run it from any location on the disk because it doesn't have all the dependencies that the installed application required the installer to set up.

Installation vs Compiling
Installing an application usually doesn't compile it (with the notable exception of many unix/linux platforms). It comes to you already in executable form. You can't see the source code because whoever created the application already compiled it. You say you can't figure out how to run java programs without installing eclipse or "cpp programs" without installing Visual C++. This makes no sense at all. First of all, you don't need Eclipse to compile java programs, you just need a java compiler. Eclipse is a java IDE (which may or may not provide its own java compiler, I don't know, I don't use java). Secondly, you don't need to compile a java program to run it. If you've received a java program it's probably java bytecode, which can be run directly through your java runtime. Thirdly, a compiled C++ program is simply an executable. It's native code that runs directly on the platform (hardware), not through any runtime. You never need anything (aside from dynamic library dependencies, or other sorts of runtime dependencies) to run a compiled C++ program.

Compiled languages vs Interpreted languages
A compiled language is one like C++ or Java that you have to compile. The compilation step turns your source code into binary object code that can be executed on your machine. An interpreted language doesn't require any such step. Instead, the source code is read by an executable and the commands in the source code are then performed by that executable. This includes most scripting languages. A scripting language is a programming language by the way, contrary to your false dichotomy.

I think what you're asking is:
Are there any languages that I can write a program in that don't have to be compiled or interpreted. The answer is yes, machine code. Even writing in assembly language required an assembler, which translates what you wrote into machine language for the platform you're on. If you are planning to write machine code you will have to write it in binary or hexadecimal, and you will have to know the opcodes and keep track of your own memory addresses. You won't be able to use notepad, since that outputs ascii. It will be a bunch of numbers. You don't want to do that.

So why are you trying to do what you're trying to do? Why do you hate installing things?

You also asked how an embedded java applet runs on your computer without having installed javac. Easy, you don't have to compile a java application to be able to run one. You're downloading java bytecode which is then interpreted by your java runtime. The javac would simply turn java sourcecode into bytecode.

#4 JoeCooper   Members   -  Reputation: 338

Like
1Likes
Like

Posted 29 June 2011 - 12:47 PM

Punch cards.

...

No, really, if this is just for personal fun, why not go explore some extreme retro-computers? (I assume it's for personal fun since it's otherwise a nonsensical demand.)

#5 Serapth   Crossbones+   -  Reputation: 5475

Like
0Likes
Like

Posted 29 June 2011 - 12:48 PM

Your definition of low level is really really really bad, as low level is already well defined in the world of computer programming. ( Low level refers to the level of abstraction between the programming language and the under-lying hardware, with low level languages being the least abstracted ).


Truth is though, I don't think you really understand the compilation process. All code at some point is translated from text form into machine runnable ( for virtual machine runnable ) format, or is run within a hosted environment ( like BATCH programming run within CMD.exe process ). Even assembly code is run through an assembler to create an executable program.



One thing you should look into is Static Linking, which allows you to pack all the required libraries and files into a single EXE file. Frankly if you want to create small, portable, self contained code, C is what you are looking for. That said, I would rather cut off my own manhood than work in C again.

#6 HelloSkitty   Members   -  Reputation: 152

Like
0Likes
Like

Posted 29 June 2011 - 01:39 PM

You're conflating lots of different concepts.

The installer puts files where they need to be. It may put the application in C:\Program Files(x86)\, or it might let you choose where to put it.


Your definition of low level is really really really bad.

Truth is though, I don't think you really understand the compilation process.


if this is just for personal fun


Yes... I'm fairly able as a programmer in java, but I'm totally lost when it comes to computer science theory with the compilers and interpreters and everything. My main issue is school computers which don't seem to have any way of running code that is written on the spot. It is partially just for personal fun, as I can write java in text and move it between computers all the same, but it'd be nice to be able to run it from a school computer. Is there any chance of being able to directly write an exe or jar file, or is just not worth the effort?

@A Brain in a Vat: So if something were installed onto a flash drive, could it still run, even though it's not on the actual computer?
A penny for my thoughts? Do you think I have only half a brain?

Not-so-proud owner of blog: http://agathokakologicalartolater.wordpress.com/

#7 A Brain in a Vat   Members   -  Reputation: 313

Like
0Likes
Like

Posted 29 June 2011 - 01:44 PM

Yes... I'm fairly able as a programmer in java, but I'm totally lost when it comes to computer science theory with the compilers and interpreters and everything. My main issue is school computers which don't seem to have any way of running code that is written on the spot. It is partially just for personal fun, as I can write java in text and move it between computers all the same, but it'd be nice to be able to run it from a school computer. Is there any chance of being able to directly write an exe or jar file, or is just not worth the effort?

@A Brain in a Vat: So if something were installed onto a flash drive, could it still run, even though it's not on the actual computer?

If an executable was on a flash drive, and then you connected that flash drive to the computer, then yes that executable could run on the computer.

That doesn't mean your school doesn't have some kind of protection against that possibility.

So are you not learning to program in school? Because if you are they should provide systems with compilers on them.

If they don't, you'll just have to install a compiler on your home computer, and if you don't have one you'll just have to get one.

#8 UltimaX   Members   -  Reputation: 467

Like
-2Likes
Like

Posted 29 June 2011 - 02:01 PM

Assembly is apparently the most basic language, and I'd gladly learn it if I could figure out how to run it.


ASM is the most basic language in the sense that a CPU can understand and execute it. The actual programming of ASM is not so basic.

For future reference, you can run ASM inside of Visual Studio. See here for more information.

#9 A Brain in a Vat   Members   -  Reputation: 313

Like
1Likes
Like

Posted 29 June 2011 - 02:07 PM

ASM is the most basic language in the sense that a CPU can understand and execute it. The actual programming of ASM is not so basic.

For future reference, you can run ASM inside of Visual Studio. See here for more information.

This is not true. A CPU cannot understand and execute assembly. Please read what I wrote above.

#10 Serapth   Crossbones+   -  Reputation: 5475

Like
2Likes
Like

Posted 29 June 2011 - 02:09 PM


Assembly is apparently the most basic language, and I'd gladly learn it if I could figure out how to run it.


ASM is the most basic language in the sense that a CPU can understand and execute it. The actual programming of ASM is not so basic.

For future reference, you can run ASM inside of Visual Studio. See here for more information.



This actually, is wrong. ASM is about as low level as languages get, but it is not machine executable, it still gets compiled down to machine code and linked with the appropriate headers etc depending on format ( such as ELF on Linux or PE on Windows ).



EDIT: Damn your quickness Brain!

#11 A Brain in a Vat   Members   -  Reputation: 313

Like
0Likes
Like

Posted 29 June 2011 - 02:11 PM

EDIT: Damn your quickness Brain!

I don't rely on your slow typing. My vat is directly connected.

#12 ApochPiQ   Moderators   -  Reputation: 15765

Like
3Likes
Like

Posted 29 June 2011 - 03:00 PM

Yes... I'm fairly able as a programmer in java, but I'm totally lost when it comes to computer science theory with the compilers and interpreters and everything. My main issue is school computers which don't seem to have any way of running code that is written on the spot. It is partially just for personal fun, as I can write java in text and move it between computers all the same, but it'd be nice to be able to run it from a school computer. Is there any chance of being able to directly write an exe or jar file, or is just not worth the effort?

@A Brain in a Vat: So if something were installed onto a flash drive, could it still run, even though it's not on the actual computer?




Nothing runs code "just from a text file." You either have an interpreter (as is the case with Python, batch, and many other scripting languages) or a compiler (as is the case with Java and C++). Some obscure languages, including older BASIC dialects and some flavours of C, can be run either way - but one of those tools must be present. An interpreter essentially runs the program "raw" whereas a compiler translates it into some other format, which can then be run "by itself" (for native programs) or with the aid of other programs again (for virtual-machine based platforms such as Java and C#).

Software relationships are incredibly complex and intricate; there may be literally dozens of different pieces of software involved in just installing and running something like Notepad or Calculator. Web browsers and programming language environments and video games can involve hundreds. Major server systems that power MMOs, web sites, and Youtube might involve thousands of distinct pieces of software, when you account for the entire ecosystem.

This is, by and large, actually a good thing. It means we can rely on other people to do a good job at certain features, while we focus on the features that matter to us. Hence the presence of libraries, APIs, platforms, frameworks, kits, and all manner of software that exists solely to help make other software possible.

One of the deep truths of modern computing is that no program is an island. There will inevitably be many different pieces of software involved in even the most apparently trivial computing job performed on a modern PC or game console. This is less true on embedded devices like the computer that runs the fuel injectors in your car engine, but it is still true to some extent.


So, all that to say: can you write an .EXE or .JAR file without needing a compiler or some other tools? No.

At the very least, you need a hex editor or something that can support writing out binary files. Even then, you'll need to master a handful of important things before you can make even trivial programs without a compiler:

  • Executable file formats on your platform of choice (PE, ELF, etc.)
  • Machine language encoding of instructions for your CPU of choice (x86, x64, PowerPC, ARM, etc.)
  • How to program in machine language for your CPU of choice
  • How executable files are packed and how they are loaded into memory on your OS of choice
  • Dynamic as well as static code linking on your OS of choice
  • Kernel vs user space distinctions
  • How to invoke kernel code from user space, and vice versa
  • Calling conventions, typical memory models, and other methods for communicating with other libraries, APIs, and programs
And of course that's just so you can write "hello world" on the screen. If you want to do anything interesting, plan on learning about ten times that much, plus a lot of hard lessons in software architecture.


In a nutshell, your situation is this:

  • You are learning to drive
  • You can't afford your own car
  • You can only borrow a car from, say, your parents, on an infrequent basis
  • You really want to be able to drive more
The question you are asking is, "How can I drive without buying a car of my own?" The answer, of course, is you build your own car.

But this is, unquestionably, ten million times harder than just getting a job and saving up for your own car. You have to learn a huge amount about how cars work, how the tools work that are used to make cars, and so on. If you're really hardcore, you have to learn about metallurgy, and how to cast your own engine blocks and such stuff. Maybe you refuse to buy wrenches from Home Depot and must manufacture those yourself, too. And so on.

Eventually, the obvious answer should start seeming attractive: just get a job, work for a while, pay your dues, and buy your own car when you can.

The analogous answer to your programming question is similarly straightforward, although probably not what you wanted to hear: use the tools, learn how they work, and learn to appreciate them. They really are saving you a tremendous amount of pain; you just don't know it yet.

Best of luck :-)

#13 JoeCooper   Members   -  Reputation: 338

Like
0Likes
Like

Posted 29 June 2011 - 03:32 PM

What Apoch said.

EDIT: Also, you might look at Windows Powershell instead of bat files, or whatever it's called. You might be able to have a lot of fun with what windows comes with out of the box.

#14 ApochPiQ   Moderators   -  Reputation: 15765

Like
0Likes
Like

Posted 29 June 2011 - 04:18 PM

+1 for powershell. It's a pretty cool system to learn for general tinkering and gluing together various elements of larger systems.

#15 kseh   Crossbones+   -  Reputation: 2076

Like
0Likes
Like

Posted 29 June 2011 - 04:32 PM

Um... given that this is the beginner's forum and this is the first question the OP has posted, maybe it's worth while to check that the OP is just looking for how to compile something in release mode? You know... do all the work on your development machine then compile it in release mode so you can take the exe file and run it on your mom's computer.

[edit]
Sorry, I guess it's his second topic.

#16 rip-off   Moderators   -  Reputation: 8224

Like
1Likes
Like

Posted 29 June 2011 - 05:56 PM

I believe what you are struggling with is the distinction between development and deployment. Each of these environments requires and provides different runtimes and toolchains.

Speaking generally, statically compiled languages make an obvious distinction between the two environments, and dynamic languages provide the same environment for development and deployment.

So, the things you need to figure out for your language of choice are:
  • What do I need to provide as a deployment runtime?
  • Can I avoid installing this?
If you want to develop on the fly, you need to figure out the above for the development environment too.

My main issue is school computers which don't seem to have any way of running code that is written on the spot. It is partially just for personal fun, as I can write java in text and move it between computers all the same, but it'd be nice to be able to run it from a school computer. Is there any chance of being able to directly write an exe or jar file, or is just not worth the effort?

This may be possible, provided your school computers don't contain too many security restrictions. If the computers in question can run Java applets, then they have a JRE (Java deployment environment) already installed. All you need now is a portable JDK (Java development environment). On Linux I can download a JDK as a single zip, which extracted into a folder contains everything I need.

Looking at the JDK download page all the Windows packages are provided as executable installers, but it might be possible to similarly capture a JDK into a folder and make it portable. You can then move this to a USB key (if you are allowed to use them) and all you need to do is correctly set JAVA_HOME and PATH to point to the JDK. You can write a batch script that sets these variables and gives you a command prompt from which you can call the Java compiler. There are some promising ideas here.

If you get all that working then you should be able to edit, compile and run Java programs without installing an IDE. You might consider testing this deployment by using some kind of virtualisation software (e.g. VMWare) to run a "clean" Windows installation.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS