We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
.java (Read 878 times)
.java
Mar 14th, 2006, 7:36pm
 
hi to all
i started learn programmin' 6-8 months ago. lots of questions are solved lookin' at this amazing forum, but i didn't found any answer about compiling .java files...i mean....sometimes i look at someone on the web to learn something from their source codes and not all files are .pde but .java. You can view the applet inside the .html file and also you read that is made up with processing. ok. now: when you look at the source code and you wish to save it using the file later ,you discover that the file is *.java and processing cannot open it.So i tryed to compile that with xcode2 but too many errors encountered...why?! processing cannot read .java file but also if you try to modify the code for processing it doesn't work as well. what can i do to see the applet? .java file must be compiled, why i cannot do that with xcode?
i'm sorry about my bad english and i hope you'll understand ....i need help.
Re: .java
Reply #1 - Mar 15th, 2006, 9:51am
 
You can work with java files in Processing but unfortunatly so far I know you cannot create them there. To create a java file do the following. If you haven't created the processing sketch so far do that first. Open the sketch folder, now create a java file using a text editor. The fily does not need to contains any code so far. Now close Processing when you have saved the java File and reopen Processing the java file should appear there as new tab.

Now you can edit the java file and Processing will compile it for you. Here is an example.

the processing file:

Code:

JavaClass javaClass = new JavaClass();

void setup(){
println(javaClass.name);
}


the javafile JavaClass.java
Code:

public class JavaClass{
public String name = "JavaClass";
}

Re: .java
Reply #2 - Mar 15th, 2006, 10:04am
 
hi tex,
many thanks.
i'm linkin'u an example from flight404 (the most creative peoples that i never seen before!):    http://www.flight404.com/p5/bouncers8/

here u can find his sketch and also the source code(many thanks for teaching Flight404!). so..the file is .java and is made up of processing...can u show me the procedure to make that  file working! please be patience with me ...see you later..thnx tex
Re: .java
Reply #3 - Mar 15th, 2006, 11:02am
 
You can use this example right in processing. Just copy and paste. It's been writen for the alpha version of processing so you have to change some things:
loop() -> draw()
strokeWidth -> strokeWeight
BApplet ->PApplet
noBackground() -> delete this

thats it.
Re: .java
Reply #4 - Mar 15th, 2006, 11:43am
 
well done thnx
i did it
but why sometimes they wrote and save on .java ? i tried what u said but i want to try to compile the .java file to have .jar . the question is why they write code in .java and compile that to have a .jar to put on the web inside a webpage? they tell that is made up with processing but the source code is not .pde , why?and wich procedure to transform this file into .jar . sorry but i understood what u mean but i wish to know the other way to make compiled file for processing starting from .java.
many many thanks...
Re: .java
Reply #5 - Mar 17th, 2006, 2:12am
 
finally my day has come!!

happy S.Patrick   Patrik......

Ben and Casey  many thanks 4 the  present (v.0108) !!

byez
Page Index Toggle Pages: 1