PDA

View Full Version : Java



numba1xclusive
03-11-2005, 12:25 AM
Hey just a weird question. I'm in Comp Sci at school, and we basicalyl do Java stuff. How do I run my prgms I make at school at home. I have the JRE 1.42, but I dont know how to run it. Any help?

4play
03-11-2005, 12:29 AM
http://java.sun.com/j2se/1.4.2/install-windows.html

you have to install java then compile it to byte code then run it through the java virtual machine.

it means its cross machine compatible but it can take a big performace hit which really sucks sometimes.

numba1xclusive
03-11-2005, 12:39 AM
Wait, I already have the SDK, so how do I run it through that? :unsure:

Rick Phlegm
03-11-2005, 12:41 AM
If you make an applet it'll run in a browser.

But you're probably not onto applets yet. If you want them to run a class they'll need to have the JRE as well.

numba1xclusive
03-11-2005, 12:47 AM
We're doing Applications. So applets are out of the question.lol

Rick Phlegm
03-11-2005, 12:57 AM
Wait, I already have the SDK, so how do I run it through that? :unsure:
If you don't have your classpath set up for it yet, go to the /bin directory of the Java install and copy your source files there. If you've got a file called MyClass.java that you want to compile:


javac MyClass.java

If you then want to run a class called MyClass.class


java MyClass
no .class on the end

numba1xclusive
03-11-2005, 02:41 AM
Ok I got that working. But I still dont get how to configure classpaths. Like, it says to say the args, but when I do something like, "java classpaths
or some crap like that, it doesnt work.

Rick Phlegm
03-11-2005, 02:43 AM
Your classpath's an environment variable. It's set through the windows control panel.

[EDIT: More info:

Go to Control Panel > System > 'Advanced' tab > Environment Variables

Under System Variables, if CLASSPATH isn't there already, click the 'new' button, put CLASSPATH as the variable name and wherever you'll be putting your classes as the value.

Also, modify your path variable to put in the location of the /bin folder of your Java install]

numba1xclusive
03-12-2005, 02:06 AM
Ok I figured how to run it. Is there an easier way than doing all the command line stuff? Like I can use DOS and stuff, but Its a pain in the ass to continously do the typing. Is there like a Easy Button, where u just specify which class u want to run and then run it?

gildan2020
03-12-2005, 03:02 PM
u can also get JCreator, quite a good program that compiles and runs Java codes (be it applet or application)

http://www.jcreator.com/ have fun with java :)


gildan2020