Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jethroted

macrumors 6502a
Original poster
Jan 2, 2003
619
0
Cyberspace
I downloaded an app in java source code. There was no binary. I have no idea what to do with it. I'm not big into programing, source codes, and the like.

*zips up fire proof suit*

Please be gentle. ;)
 
Okay, here's what you do.

1st, you've got to find the main file. Sometimes it's labeled main, or the name of the program. It will be a .java file. Go in to terminal, and go to the file.

Then once you've found the file you type:
javac <filename.java>

This will create a .class file in the same directory as the .java file you compiled.

Then type java filename (do not put .class or .java after it).

This should complie and run the program. Let me know if you have any problems.

Physicsnerd
 
Originally posted by physicsnerd
Okay, here's what you do.

1st, you've got to find the main file. Sometimes it's labeled main, or the name of the program. It will be a .java files. Go in to terminal, and go to the file.

Then once you've found the file you type:
javac <filename.java>

This will create a .class file in the same directory as the .java file you compiled.

Then type java filename (do not put .class or .java after it).

This should complie and run the program. Let me know if you have any problems.

Physicsnerd

There are a whole bunch of .java file though. That's the majority of the content. If you want to look at the source check it out here.

I downloaded the jtella-07.zip file.
 
from the readme:

INTRODUCTION

The JTella API project is an effort to create a simple, easy to use Java
programming interface for the GNUTella network. The goal is to make it easy
to produce Java applications and tools for accessing the GNUTella network.

This is not a program like you think it is. This is an API. What these files let you do is write programs that can access the different fuctions of GNUTella. However, it is not a GNUTella client. Atleast it doesn't look to be. Can anyone verify my conclusion?

Physicsnerd
 
My brother was telling me i needed a .jar file. What do i need that for? There is one of those in the folder.
 
Originally posted by physicsnerd
from the readme:



This is not a program like you think it is. This is an API. What these files let you do is write programs that can access the different fuctions of GNUTella. However, it is not a GNUTella client. Atleast it doesn't look to be. Can anyone verify my conclusion?

Physicsnerd

Agreed. This is not a self-contained program.

You would need to write a java program to use the source code you downloaded.
 
Originally posted by szark
Agreed. This is not a self-contained program.

You would need to write a java program to use the source code you downloaded.

What? I need to write a program to use the source code? So I can't use this stuff at all with out doing that?
 
Originally posted by jethroted
What? I need to write a program to use the source code? So I can't use this stuff at all with out doing that?

well, you could find a program someone else wrote to use the library, but in general, yes.

a jar is simply a collection of pre-compiled java files. it's akin to a unix .so library or (the dreaded) windows .dll.

like those, you put the jars in a known place and direct your java environment to that place (i think the environment variable is JARPATH, but i haven't done any java in 4 years).

i recommend buying a java book and doing some reading. (sorry, i have no recommendations on which book)
 
Originally posted by zimv20
well, you could find a program someone else wrote to use the library, but in general, yes.

a jar is simply a collection of pre-compiled java files. it's akin to a unix .so library or (the dreaded) windows .dll.

like those, you put the jars in a known place and direct your java environment to that place (i think the environment variable is JARPATH, but i haven't done any java in 4 years).

i recommend buying a java book and doing some reading. (sorry, i have no recommendations on which book)

OK, so the .jar file is pre compiled. So that should be ready to run then? Or do I have to do something with it to get it ready to run?
 
Originally posted by jethroted
OK, so the .jar file is pre compiled. So that should be ready to run then? Or do I have to do something with it to get it ready to run?

as long as the program you're running (the one you don't have yet) knows where it is, you're good to go.
 
Originally posted by zimv20
as long as the program you're running (the one you don't have yet) knows where it is, you're good to go.

Oh man, I give up. Why didn't they just have the binary there? This is ridiculous, I thought compiling was as simple as taking your source code, then running it through a compiler, and then you get your binary file. That makes sense to me.
 
Originally posted by jethroted
Oh man, I give up. Why didn't they just have the binary there?

the jar _is_ the "binary."


This is ridiculous, I thought compiling was as simple as taking your source code, then running it through a compiler, and then you get your binary file. That makes sense to me.

errrr.... it is that simple. except when you're sharing code across executables, then you need to get into libraries (jarfiles, in the case of java).

and the added complexity that java runs in a virtual machine. but that complexity shouldn't affect you (since you're not writing something on the magnitude of a compiler).

buy a book. start small.
 
Originally posted by zimv20
the jar _is_ the "binary."



errrr.... it is that simple. except when you're sharing code across executables, then you need to get into libraries (jarfiles, in the case of java).

and the added complexity that java runs in a virtual machine. but that complexity shouldn't affect you (since you're not writing something on the magnitude of a compiler).

buy a book. start small.

I guess that is what i'll have to do, although i didn't really want to get into programing, I just wanted to run an app. I realize they released the source code so developers could work on it, but they should have released an executable file as well so people who just want to run the app could do so.
 
Originally posted by jethroted
they should have released an executable file as well so people who just want to run the app could do so.

but i thought it was a library you d/loaded, not an app.

also, if you're gonna muck about on the command line and d/loading source code, you will have to deal w/ some of the same things programmers do. like the non-trivial world of make
 
Originally posted by jethroted
I guess that is what i'll have to do, although i didn't really want to get into programing, I just wanted to run an app. I realize they released the source code so developers could work on it, but they should have released an executable file as well so people who just want to run the app could do so.

as has been stated above, you didn't download an app. there is nothing to run, nor can there be. you downloaded an extension, or Application Programming Interface (API), that allows you to program with more features (objects, methods).

here's a WAY out there example....

you're writing the matrix, and you have a human named Guy New that you need to create. in the existing matrix code (java) there is no way to make Guy move. so, you download a human api that includes the ability for a human move. now you can use... humanGuyNew.Move()
where you couldn't before you had this api you downloaded.

also, i saw a post earlier about javac. you actually should run javac at the same directory level as the directory that contains the .java files. example--navigate to the directory that is at the same level as this directory, then type...

javac directory/filename.java
 
Originally posted by jethroted
I guess that is what i'll have to do, although i didn't really want to get into programing, I just wanted to run an app. I realize they released the source code so developers could work on it, but they should have released an executable file as well so people who just want to run the app could do so.

The problem here is that you don't understand the basic concepts of what a program is. Read the following very carefully...

What you downloaded was NOT an application or even the source to an application. You downloaded a bunch of code that other applications can use. This is often called an API, or a library, or a .dll, etc. Think of it as a bunch of compiled code that other applications can run. As an example, Cocoa is an API similar to this application. It provides Mac OS X programmers a bunch of code which makes creating GUI's much easier.

Second, the code you downloaded wasn't packaged very well. There was no makefile or ANT script or any other device to easily compile the code or run it. This isn't your fault: the prorammers are to blame. Even if this was code you wanted (you don't want it, by the way), there wouldn't have been an easy way to compile/install/run it.

Taft
 
Sorry for being so dense. I really know nothing about programing. I did some gw basic back in high school, and that's about it. I get it now though. Thanks for your help guys.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.