Tuesday, September 13, 2011

Tricky java question!!: locating .class files, incorporating .class files into a browser, ect. PLEAS HELP!?

I’ve downloaded the jdk-6u3-windows-i586-p installation program, %26amp; installed it successfully. By default it created a folder within program files called Java. With in that there are three folders: ';jdk-6u3-windows-i586-p';, ';jre1.6.0_03';, ';jre1.5.0_03';.

In the command line I changed the directory by typing:

“cd C:\ProgramFiles\Java\jdk1.6.0_03\bin”, %26amp; then successfully translated a ‘.java’ file to a ‘.class’ file by typing: “javac HelloWorld.java” into the command line. So at this point no errors have arisen and everything is working perfectly. I tested the program by typing “javac HelloWorld” %26amp; it worked. However there doesn’t seen to be a HelloWorld.class file in the current folder. By default where does the JDK translator place the ‘.class’ file? Also how is the ‘.class’ file integrated with a webpage page and ran when someone calls that site? I’m guessing you have to invoke a PHP script that tells the server to run the ‘.class’ file. This is all new to me, any help would be greatTricky java question!!: locating .class files, incorporating .class files into a browser, ect. PLEAS HELP!?
It should be putting your .class files in the same folder as your .java was. Here's the specifics about javac: http://java.sun.com/j2se/1.4.2/docs/tool…



And putting .class files on websites doesn't involve PHP at all, just HTML. The syntax is just:



%26lt;applet code=';HelloWorld.class';%26gt; %26lt;/applet%26gt;



This is how you would get a Java program on a website, but you have to add more applet-specific stuff to your program to make it work. This site has a good tutorial for making simple applets: http://www.cs.washington.edu/homes/stepp…

No comments:

Post a Comment